jprichardson / buffer-json Goto Github PK
View Code? Open in Web Editor NEWJSON reviver/replacer methods for JavaScript Buffer type.
JSON reviver/replacer methods for JavaScript Buffer type.
What does this library offer over the follow native solution?
const buf = Buffer.from(JSON.stringify(obj));
const json = JSON.parse(buf.toString());
Hi JP, I've been using this library in a project and noticed that it crashes when keys are undefined, as can be seen in this Runkit.
var bufferJson = require("buffer-json")
JSON.stringify({ohNo: undefined}, bufferJson.replacer)
// => TypeError: Cannot read property 'type' of undefined
This is the same bug that caused PR #1.
Because I needed to make progress, I forked the project & fixed the bug - I noticed that the module is quite outdated now, so it resulted in a complete rewrite (ie. it is currently using the deprecated Buffer constructor, deprecated mocha methods etc.): https://github.com/lachenmayer/buffer-json
I'm happy to use the fork namespaced under my name for now (@lachenmayer/buffer-json), but it might be useful to others too. I also made the documentation a bit clearer & removed all the references to Node 0.10, as they're not really relevant anymore.
I haven't opened a PR for this, as I'm not sure if you want to keep maintaining this module and merge in the changes, or if it would be more useful transfer ownership and/or mark this repo as deprecated. Let me know what works for you.
Thanks a lot!
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.