|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
348 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | module.exports = string => {
|
|---|
| 4 | if (typeof string !== 'string') {
|
|---|
| 5 | throw new TypeError(`Expected a string, got ${typeof string}`);
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | // Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
|
|---|
| 9 | // conversion translates it to FEFF (UTF-16 BOM)
|
|---|
| 10 | if (string.charCodeAt(0) === 0xFEFF) {
|
|---|
| 11 | return string.slice(1);
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | return string;
|
|---|
| 15 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.