Files
notification-elements-demo/node_modules/iconv-lite/lib/bom-handling.js
Giuliano Silvestro 5d0c9ec7eb Initial commit: notification-elements-demo app
Interactive Angular 19 demo for @sda/notification-elements-ui with
6 sections: Bell & Feed, Notification Center, Inbox, Comments &
Threads, Mention Input, and Full-Featured layout. Includes mock
data, dark mode toggle, and real-time event log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:49:19 +10:00

49 lines
1.0 KiB
JavaScript

"use strict"
var BOMChar = "\uFEFF"
exports.PrependBOM = PrependBOMWrapper
function PrependBOMWrapper (encoder, options) {
this.encoder = encoder
this.addBOM = true
}
PrependBOMWrapper.prototype.write = function (str) {
if (this.addBOM) {
str = BOMChar + str
this.addBOM = false
}
return this.encoder.write(str)
}
PrependBOMWrapper.prototype.end = function () {
return this.encoder.end()
}
// ------------------------------------------------------------------------------
exports.StripBOM = StripBOMWrapper
function StripBOMWrapper (decoder, options) {
this.decoder = decoder
this.pass = false
this.options = options || {}
}
StripBOMWrapper.prototype.write = function (buf) {
var res = this.decoder.write(buf)
if (this.pass || !res) { return res }
if (res[0] === BOMChar) {
res = res.slice(1)
if (typeof this.options.stripBOM === "function") { this.options.stripBOM() }
}
this.pass = true
return res
}
StripBOMWrapper.prototype.end = function () {
return this.decoder.end()
}