ref: ee85765f9277bc31165c0080b57e4ee1f862d2d0 bare-js/README.md -rw-r--r-- 1.5 KiB
ee85765f — Emma Initial commit, first usable state 7 months ago


This is a work-in-progress JavaScript/Node.js implementation of BARE.

The idea so far is, that the parser and converter will run with node.js, while the resulting JavaScript classes should be usable in any JavaScript environment.

Have a look at examples.js on how to create type definitions in code for now. Or peek inside the lib-bare.js, where all conversion classes are located. These are to be used directly when defining your own type. Whenever a type takes some sort of arguments, they are static variables right at the top, just make sure to set them correctly since there are, as of now, no integrity checks on them.

###What is still missing

  • The schema to js translator
  • Union and Enum types These are difficult to translate to js, so I'm going to have to think about use cases and how to make them convenient to use
  • Conversion error handling and integrity verification
  • Unit tests, these will come last

###Known Issues Javascript is a wonderful language, and as such it doesn't actually have an integer type. Instead, every single number is stored as a double precision float. This limits the usable range of integers to 53 bits, which means the maximum unsigned value is just over 9 quadrillion (10^15) and about ±4.5e15 for signed integers, though that could technically be expanded to ±9e15 since the sign is technically stored outside of the 53 bits. In my use case this is not a problem, but for proper adherence to spec this should be addressed.