Open tfius opened 2 years ago
it is not required to name the variable as json
, it is one property of first parameter of the constructor.
you can init BeeSon with data
in the following way:
const beeson1 = new BeeSon({ json: data })
or you can even init BeeSon object with a TypeManager object: new BeeSon({ typeManager })
- in which case you can use any variablenames for defining typeManager as well.
Is this clear from the readme docs, or should sth be added, maybe example? Otherwise issue close, please.
When constructing new BeeSon object from JavaScript keep in mind that due to
interface JsonParams<T extends JsonValue> { json: T; }
creation of BeeSon object requires that input variable is named
json
or else constructor will fail and return Invalid BeeSon constructor parametersto recap:
let data = { name: 'john coke', age: 48, id: 'ID2' }
let json = { name: 'john coke', age: 48, id: 'ID2' }
const beeson1 = new BeeSon({ data })
will NOT workconst beeson2 = new BeeSon({ json })
will work