borewit / token-types Goto Github PK
View Code? Open in Web Editor NEWA primitive token library used to read from, and to write a node Buffer
License: MIT License
A primitive token library used to read from, and to write a node Buffer
License: MIT License
Hi, today I was building some docker images when I suddenly found the following error:
#10 33.94 > [email protected] build /app
#10 33.94 > tsc -p .
#10 33.94
#10 38.73 node_modules/strtok3/lib/type.d.ts(2,27): error TS7016: Could not find a declaration file for module 'token-types'. '/app/node_modules/token-types/lib/index.js' implicitly has an 'any' type.
#10 38.73 Try `npm install @types/token-types` if it exists or add a new declaration (.d.ts) file containing `declare module 'token-types';`
I'm using the package music-metadata which has a dependency that uses this package and with the 1.0.2 version I'm getting this error. On the other hand, if I force a package downgrade by issuing the command npm install [email protected]
I can get the TS files compiled. It seems that the types are not uploaded in 1.0.2, couldn't be? Or maybe I forgot something?
Thanks.
Seems like the wrong export in package.json. Quick fix:
"exports": {
".": {
"node": "./lib/index.js",
"default": "./lib/index.js"
}
},
Originally posted by @AaronPorts in #393 (comment)
Switch to BigInt for 64 bit values.
I just created a PR, but the workflow is only configured to run on pushes. It would be nice if the tests run to ensure that nothing breaks before the PR is merged.
Related to Borewit/strtok3#15
DataView is fast in v8 now
could you perhaps switch to operate on Uint8Array + DataView so it would make it less dependent on NodeJS Buffer module so the browser bundle wouldn't have to be as big?
Defeat the ~32-bit limit (in some case there a few more bits available)
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
#
is the defacto way off writing private methods nowdays.
anything that isn't #
is a public method.
Line 424 in b748989
I expect public/private to fade away eventually... some linters recommend it instead cuz it's the "right way" to write it
it makes it also more clear when you look at a piece of code and you can instantly tell if a method is a private method just by looking at this.#
I was debugging a other code to look what it was doing and saw: "ah this method seems interesting, i wonder if i can use it directly instead", but turned out that method was private when i tried to use it. Would have instantly know if it had this.#foo()
instead...
Take over string decoding functionality from music-metadata.
Related issue: Borewit/music-metadata#44
In this case it's the master
branch. We can add ?branch=master
to the URL according to the docs.
That way even if a PR is failing the build doesn't show as broken.
lib/index.ts
class StringType { constructor(len, encoding) { this.len = len; this.encoding = encoding; } get(uint8Array, offset) { return Buffer.from(uint8Array).toString(this.encoding, offset, offset + this.len); } }
Expected value: 'application/epub+zip'
Actual value: 'application/epub+zip
'
Some of the links for the epub files are here:-
https://soundplay-reports.s3.amazonaws.com/1.epub
https://soundplay-reports.s3.amazonaws.com/2.epub
Issue is raised in npm file-type
sindresorhus/file-type#537
Resolution
The extra space should be truncated by the library.
In favour of: Borewit/music-metadata#25
The IgnoreType
token should return void
and not Buffer
Forgive me if I'm reporting a false alarm, but I'm still wrapping my head around tokenizers. I was looking at lib/index.ts
and saw that the 8-bit signed integer is returning offset + 2
. Shouldn't this be offset + 1
, or am I misunderstanding what's happening here?
Lines 130-145:
/**
* 8-bit signed integer
*/
export const INT8: IToken<number> = {
len: 1,
get(array: Uint8Array, offset: number): number {
return dv(array).getInt8(offset);
},
put(array: Uint8Array, offset: number, value: number): number {
dv(array).setInt8(offset, value);
return offset + 2;
}
};
To be able to decode float values in EBML, music-metadata need to be able to read:
Required for music-metadata#356
PR: #56
Hi,
Like Borewit/strtok3#365 and Borewit/peek-readable#229, the package published on NPM contains//# sourceMappingURL=index.js.map
at the end of the index.js
file but index.js.map
is missing from the package.
It's not a real issue but VSCode started to complain about it. See microsoft/vscode#102042
Thanks ๐
Previously I made a change to only run CI on Pull Requests, but we should also run CI when commits are pushed to master to ensure that master is building (after PR merge or direct pushes to master).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.