Skip to content

Commit

Permalink
Update to token-types 4.0.1 & strtok3 6.2.2 (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit authored Jul 22, 2021
1 parent 67c8fcb commit 568ebd1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ declare namespace core {
If file access is available, it is recommended to use `.fromFile()` instead.
@param buffer - A buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well.
@param buffer - An Uint8Array or Buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well.
@returns The detected file type and MIME type, or `undefined` when there is no match.
*/
function fromBuffer(buffer: Buffer | Uint8Array | ArrayBuffer): Promise<core.FileTypeResult | undefined>;
function fromBuffer(buffer: Uint8Array | ArrayBuffer): Promise<core.FileTypeResult | undefined>;

/**
Detect the file type of a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable).
Expand Down
4 changes: 2 additions & 2 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ async function fromStream(stream) {
}

async function fromBuffer(input) {
if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) {
if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) {
throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``);
}

const buffer = input instanceof Buffer ? input : Buffer.from(input);
const buffer = input instanceof Uint8Array ? input : new Uint8Array(input);

if (!(buffer && buffer.length > 1)) {
return;
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"vcf"
],
"devDependencies": {
"@tokenizer/token": "^0.3.0",
"@types/node": "^13.1.4",
"ava": "^2.3.0",
"noop-stream": "^0.1.0",
Expand All @@ -196,9 +197,9 @@
"xo": "^0.25.3"
},
"dependencies": {
"readable-web-to-node-stream": "^3.0.0",
"strtok3": "~6.1.3",
"token-types": "^3.0.0"
"readable-web-to-node-stream": "^3.0.2",
"strtok3": "^6.2.2",
"token-types": "^4.0.1"
},
"xo": {
"envs": [
Expand Down

0 comments on commit 568ebd1

Please sign in to comment.