Giter Club home page Giter Club logo

Comments (8)

nickyout avatar nickyout commented on July 18, 2024

I can recall testing pretty much every configuration across, well, just about every desktop and mobile browser. It is supposed to do the same as json-stable-stringify... but faster. That should be all.

But perhaps there is indeed a case I did not cover yet. Please give me a case where you get invalid json. I'm curious.

from fast-stable-stringify.

NawarA avatar NawarA commented on July 18, 2024

yup...sorry for the delay! here's an example of invalid JSON as an output based on input

const Stringify = require('json-stable-stringify');
const fastString = require('fast-stable-stringify');

const obj = {
        a: {
            e: {
                alpha: 'feed5c9cdae3cae69202a5af67fc99c5dc9e8d30e1aef8d294f6bfb0c2aad45a',
                beta: '4def11058e66f2d8824b1c1b54e5f6efe0537338c32be558ce4e1f8ce6b66893',
                theta: '9bcb68bad9e70e17ddebca3a6c668af59b13fd2e06f558ea00c259113bafda8c',
                phi: 'd50a4ace00559b04fe99f117cf942097f4293652ca4454492e67e2e36dccedea',
                omega: '111ce70909455ee61f8c53ff18701c557714972856708277a2d1ac9d7a7d7a13',
                delta: '66cee05cd51948b4ab02c1393fae28c2d557f92f21275ce1ca2ac69fff54b830'
            },
             f: {
                cat: true,
                dog: false,
                lizard: true,
                bird: false,
                fish: false,
                bug: false
            },
             secretAgent: 'For queen and country',
             james: 'His name',
             bond: 'His last name'
         },
        b: {
            g: { age: -6 }, f: {}
        },
        c: {
            h: {
                door: 'knob',
                window: 'sill',
                hallway: undefined
            },
             f: {},
             hdoor: 'knob',
             hwindow: 'sill',
             hhallway: undefined },
        d:{
             i: 0.69,
             j: 'english',
             k: '32bit',
             l: 8,
             m: '81448148184148141908',
             n: '2.1875',
             o: '10,true,true',
             p: 'hello world',
             q: 4,
             r: 1,
             s: 3,
             t: 'operating systems',
             u: 'versions'
         }
  };
console.log( Stringify(obj) === fastString(obj) );
// the library produces invalid JSON string.
// meanwhile json-stable-stringify produces a valid JSON string

from fast-stable-stringify.

NawarA avatar NawarA commented on July 18, 2024

This is on Node 6.10.0 LTS

from fast-stable-stringify.

nickyout avatar nickyout commented on July 18, 2024

I think I see why. Thanks a lot for the heads up. I need to fix this.

from fast-stable-stringify.

NawarA avatar NawarA commented on July 18, 2024

No Problem! I thought I'd share, since I love your approach of the highest performance deterministic JSON stringify. I was thinking about writing this lib up myself, so I appreciate that you beat me to it. Great job on this lib! :)

from fast-stable-stringify.

NawarA avatar NawarA commented on July 18, 2024

Any chance of releasing the fix you noticed? We'd love to fully switch over to this library, given it correctly makes JSON strings

from fast-stable-stringify.

nickyout avatar nickyout commented on July 18, 2024

It was already 2 weeks ago, huh. Time flies.

I just made a fix and a simple test addition to cover this particular case.

...and while checking the code, I found a simplification that appears to slightly improve speed :)

I will update the README and push a release right away.

from fast-stable-stringify.

nickyout avatar nickyout commented on July 18, 2024

And it's done: 0.2.0. Tell me if it works for you.

from fast-stable-stringify.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.