To check if the struct is a child of the given struct Schema of struct, you could inspect this property after defining the struct. Nothing special about this, just used to to identify JKT struct on internal parser. You shouldn't use the following reserved words as a property for your struct, because it was reserved to support the module. These are detailed function & properties you could use when using jkt struct. > See the result on RunKit Struct & Instance References Name->full_name: String // mapping from source key (name) to new key (full_name)Īddress->address2: String // mapping from source key (address) to new key (address2)Īge->ageInString: String // mapping from source key (age) to new key (ageInString) with type String By this point you got a very reusable component as you may need the same structure on another struct (eg. Nested StructĮvery single struct we define is an independent structure that could be used with another struct. You can assume the Person as a structure for json data, then every time you do parsing, you just have to pass an argument into Person.Ĭonst TSize = jkt.ENUM`small, medium, large, extra_large: $. Numeric type value, works for either Integer or Floatīoolean type value, works for either Integer or Floatĭate type value that accept ISO 8601, supported by Moment and it is timezone aware (will convert to UTC time) based on your machine timezoneįorce to only accept valid date value and will produce timezone aware dateĭate type value that accept ISO 8601, supported by Moment and it is not timezone awareįorce to only accept valid date value and will not produce timezone aware date Basically JKT really depends on ES6 style which using template literal in practice. To use JKT you need a NodeJS version 6.4.0 and up. It's basically just a simple parser to handle property types, the structure and provide a small helper to handle the data. JKT is a simple Javascript module to create a structure for your JSON. Then I do research and no one module is available to fit in with my case, so I built this one. So confusing when every time I checking up the right parameters to my function, make sure the produced JSON data are valid and parsing all over the JSON properties to follow my rules (types).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |