Skip to content

Commit 1281f96

Browse files
authored
feat: add strip-bom and strip-bom-string to replacements (#692)
* feat: add `strip-bom` and `strip-bom-string` to replacements * Apply suggestion from @gameroman
1 parent d02204a commit 1281f96

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

manifests/micro-utilities.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@
360360
"description": "You can split a string into lines using a regular expression.",
361361
"example": "const splitLines = (str) => str.split(/\\r?\\n/);"
362362
},
363+
"snippet::strip-bom": {
364+
"id": "snippet::strip-bom",
365+
"type": "simple",
366+
"description": "You can check if the first character of the string is the BOM and strip it using `String.prototype.slice` if it is.",
367+
"example": "str.charCodeAt(0) === 0xFEFF ? str.slice(1) : str;"
368+
},
363369
"snippet::to-lower": {
364370
"id": "snippet::to-lower",
365371
"type": "simple",
@@ -812,6 +818,16 @@
812818
"moduleName": "split-lines",
813819
"replacements": ["snippet::split-lines"]
814820
},
821+
"strip-bom": {
822+
"type": "module",
823+
"moduleName": "strip-bom",
824+
"replacements": ["snippet::strip-bom"]
825+
},
826+
"strip-bom-string": {
827+
"type": "module",
828+
"moduleName": "strip-bom-string",
829+
"replacements": ["snippet::strip-bom"]
830+
},
815831
"toarray": {
816832
"type": "module",
817833
"moduleName": "toarray",

0 commit comments

Comments
 (0)