Skip to content

Commit

Permalink
chore: Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored and actions-user committed Jan 10, 2022
1 parent 8fece9c commit bc47af6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 49 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ var removeBOM = require('remove-bom-stream');

fs.createReadStream('utf8-file-with-bom.txt')
.pipe(removeBOM())
.pipe(concat(function(result) {
// result won't have a BOM
}));
.pipe(
concat(function (result) {
// result won't have a BOM
})
);
```

## API
Expand All @@ -34,7 +36,6 @@ Returns a `through2` stream that will remove a BOM, given the data is a UTF8 Buf

MIT


<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/remove-bom-stream.svg?style=flat-square
[npm-url]: https://npmjs.com/package/remove-bom-stream
Expand Down
86 changes: 41 additions & 45 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ var removeBomStream = require('../');
var pipe = miss.pipe;
var concat = miss.concat;

describe('removeBomStream', function() {

it('ignores UTF8 buffer without a BOM', function(done) {
describe('removeBomStream', function () {
it('ignores UTF8 buffer without a BOM', function (done) {
var filepath = path.join(__dirname, './fixtures/test.txt');

var expected = fs.readFileSync(filepath);
Expand All @@ -24,14 +23,13 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});

it('removes the BOM from a UTF8 buffer', function(done) {
it('removes the BOM from a UTF8 buffer', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf8.txt');

var expected = fs.readFileSync(filepath).slice(3);
Expand All @@ -40,14 +38,13 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});

it('handles small chunks', function(done) {
it('handles small chunks', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf8.txt');

var expected = fs.readFileSync(filepath).slice(3);
Expand All @@ -56,15 +53,18 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
chunker(1),
removeBomStream(),
concat(assert),
], done);
pipe(
[
fs.createReadStream(filepath),
chunker(1),
removeBomStream(),
concat(assert),
],
done
);
});

it('removes the BOM from a UTF8 buffer that is shorter than 7 chars', function(done) {
it('removes the BOM from a UTF8 buffer that is shorter than 7 chars', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf8-short.txt');

var expected = fs.readFileSync(filepath).slice(3);
Expand All @@ -75,14 +75,13 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});

it('does not remove the BOM from a UTF16BE buffer', function(done) {
it('does not remove the BOM from a UTF16BE buffer', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf16be.txt');

var expected = fs.readFileSync(filepath);
Expand All @@ -91,14 +90,13 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});

it('does not remove the BOM from a UTF16BE buffer that is shorter than 7 chars', function(done) {
it('does not remove the BOM from a UTF16BE buffer that is shorter than 7 chars', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf16be-short.txt');

var expected = fs.readFileSync(filepath);
Expand All @@ -107,14 +105,13 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});

it('does not remove the BOM from a UTF16LE buffer', function(done) {
it('does not remove the BOM from a UTF16LE buffer', function (done) {
var filepath = path.join(__dirname, './fixtures/bom-utf16le.txt');

var expected = fs.readFileSync(filepath);
Expand All @@ -123,10 +120,9 @@ describe('removeBomStream', function() {
expect(isEqual(data, expected)).toEqual(true);
}

pipe([
fs.createReadStream(filepath),
removeBomStream(),
concat(assert),
], done);
pipe(
[fs.createReadStream(filepath), removeBomStream(), concat(assert)],
done
);
});
});

0 comments on commit bc47af6

Please sign in to comment.