GithubHelp home page GithubHelp logo

Comments (3)

jamuhl avatar jamuhl commented on May 27, 2024

The reason for this is that numbers are considered to be index in array (that is a normal behaviour you get when using flatten/unflatten)

{
  "key": ['a', 'b']
}

will become

{
  "key.0": 'a',
  "key.1": 'b'
}

to avoid this behavior just add one key not being a numeral like:

{ "foo": { "100": "bar", "avoidIt": " " } }

results in and will get converted back correctly

{
  "key.100": 'bar',
  "key.avoidIt": ' '
}

10000 is not supported as we check for the array length...and some point we say there must be an error -> no one fills a translation array with over 10000 items.

from locize-cli.

benma avatar benma commented on May 27, 2024

I see, so flat and unflat are not proper inverses of each other :( Thanks, I will work around it.

from locize-cli.

jamuhl avatar jamuhl commented on May 27, 2024

not a 100% but that is a tradeoff: https://www.npmjs.com/package/flat

we at least extended it to make it an object if there is one non numeral value. In most cases that works fine eg having something like:

{
  errors: {
    default: 'something went wrong',
    400: 'page not found',
    ....
  }
}

from locize-cli.

Related Issues (20)

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.