Giter VIP home page Giter VIP logo

bombadil's People

Contributors

mtiller avatar sgarciac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

umegaya

bombadil's Issues

Bug?

I noticed the function fromCodePoint appears to expect a number. But it is called as follows:

  return fromCodePoint([parseInt(codeString, 16)]);

I don't see how to reconcile these except to remove the []s from around the result returned by parseInt.

I located this because I turned noImplicitAny on in the code and make sure that nothing ended up with implicit types and this popped out as something where I couldn't find a consistent type for the function argument.

PS - with the suggested change (and several others), I was able to create a version of bombadil that doesn't include any implicit types and still passes 100% of tests from #2. Shall I submit a PR with those changes and this fix?

Use of 'instanceof'

This library looks really interesting and I need something like this. But potential issue I see is with the use of instanceof in discriminating your union types. I've used a similar approach in libraries before and been bitten badly. The issue arises when you instantiate instances of these classes from different packages/modules. They will not end up with the same class so instanceof will fail in surprising and unintuitive ways.

My solution has been to rework the code to use discriminated unions with explicit tags. I see no downside to this approach. Is this something you'd accept a pull request for?

Error thrown if creating duplicate key in object structure

if I create a simple toml with a repeating object declaration, I get an error in reader.errors.

[obj]
subobj.id = 123
subobj.id = 456

TypeError: Cannot read property 'type' of null.

It would be nice to have a nicer error in this case.

Thanks! Great lib!

table should extend null

toString = 1

This will make the parsing fail, and return null.

There is two way to fix this,

  1. use hasOwnProperty, not in
  2. use Object.create(null) to create a table, not {}

But the first way is slow, and can't deal with __proto__ property, so the way 2 is better.

Tests

Would you accept a PR that included some tests?

json/object to toml

I've looked around in the code base and the tests but I can't find anywhere where can output to toml from either a json or a general object.

Is it it possible?

Failure to parse on integer value: 0

reader.readToml('key = 0').result = null
reader.readToml('key = 0', true).result = { key: { type: 'atomicInteger', image: '0', value: 0 } }

Not sure if this is intended behaviour, but it's inconsistent with the TOML specification.
By the way, the errors object is empty, even when getting a null result

The same thing does not happen with integer value: 1
reader.readToml('key = 1').result = { key: 1 }

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.