Closed nojvek closed 4 years ago
Hi @nojvek, fair point. I was taking a look at the readme and realized it could be a little more clear.
I will try to explain here a little better and will use that to change the README later. Please consider the the section Usage
of the README.
As I tried to show in the README, this simdjson
wrapper has only three functions: isValid
, parse
and lazyParse
. I will explain the rationale behind all of them.
(jsonString: string) => boolean
JSON.parse
as well as have the same signature.node-addon-api
). For more details, check issue #5simdjson
(with the same parsing speed as the upstream), while still avoiding the overhead of constructing a full JavaScript object and focusing on lazily constructing only important pieces of the parsed object. Issue #5 has a very detailed explanation of this problem.valueForKeyPath
, which is similar to the NSObject valueForKeyPath
where:
type JSONDataType
: is any of { string, number, object, array, boolean, null }
interface LazyParsedJSON {
valueForKeyPath: (keyPath: string) => JSONDataType
}
I hope this is a little better than the current documentation. See that the type JSONDataType
and interface LazyParsedJSON
would not necessarily be reflected in TypeScript, but I hope that it helps it to make the project a little more clear. Also, see that the wrapper is in simdjson
version 0.2.1
and @lemire has updated it to version 0.3
and I am working so to update the node library (issues #24, #23 and #3). So if you can help here, your work would really be appreciated!
Cheers, Luiz
I've moved what I explained here to the file Documentation.md
Sweeet. I will take a pass tomorrow.
Closing this as PR #30 addresses that, thank you for your work @nojvek!
Great library, although the interface is somewhat unintuitive. Is
isValid
the only method?Would love to see typescript types so the library interface is fully documented. I can help here. Just don't really know what the interface right now is, and how to make most of the library.