commit
45d3fa9f89
@ -1,7 +1,7 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver" %*
|
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
||||||
) ELSE (
|
) ELSE (
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
node "%~dp0\..\semver\bin\semver" %*
|
node "%~dp0\..\semver\bin\semver.js" %*
|
||||||
)
|
)
|
||||||
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@ -1 +1 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf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CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||||
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@ -1 +1 @@
|
|||||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
||||||
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CA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ACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
||||||
File diff suppressed because one or more lines are too long
@ -1,7 +0,0 @@
|
|||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
|
|
||||||
@ -1,274 +0,0 @@
|
|||||||
3.12.20 / 2019-08-16
|
|
||||||
* Revert: Fix #167: '>' in attribute value as it is causing high performance degrade.
|
|
||||||
3.12.19 / 2019-07-28
|
|
||||||
* Fix js to xml parser should work for date values. (broken: `tagValueProcessor` will receive the original value instead of string always) (breaking change)
|
|
||||||
3.12.18 / 2019-07-27
|
|
||||||
* remove configstore dependency
|
|
||||||
3.12.17 / 2019-07-14
|
|
||||||
* Fix #167: '>' in attribute value
|
|
||||||
3.12.16 / 2019-03-23
|
|
||||||
* Support a new option "stopNodes". (#150)
|
|
||||||
|
|
||||||
Accept the list of tags which are not required to be parsed. Instead, all the nested tag and data will be assigned as string.
|
|
||||||
* Don't show post-install message
|
|
||||||
3.12.12 / 2019-01-11
|
|
||||||
* fix : IE parseInt, parseFloat error
|
|
||||||
3.12.11 / 2018-12-24
|
|
||||||
* fix #132: "/" should not be parsed as boolean attr in case of self closing tags
|
|
||||||
3.12.9 / 2018-11-23
|
|
||||||
* fix #129 : validator should not fail when an atrribute name is 'length'
|
|
||||||
3.12.8 / 2018-11-22
|
|
||||||
* fix #128 : use 'attrValueProcessor' to process attribute value in json2xml parser
|
|
||||||
3.12.6 / 2018-11-10
|
|
||||||
* Fix #126: check for type
|
|
||||||
3.12.4 / 2018-09-12
|
|
||||||
* Fix: include tasks in npm package
|
|
||||||
3.12.3 / 2018-09-12
|
|
||||||
* Fix CLI issue raised in last PR
|
|
||||||
3.12.2 / 2018-09-11
|
|
||||||
* Fix formatting for JSON to XML output
|
|
||||||
* Migrate to webpack (PR merged)
|
|
||||||
* fix cli (PR merged)
|
|
||||||
3.12.0 / 2018-08-06
|
|
||||||
* Support hexadecimal values
|
|
||||||
* Support true number parsing
|
|
||||||
3.11.2 / 2018-07-23
|
|
||||||
* Update Demo for more options
|
|
||||||
* Update license information
|
|
||||||
* Update readme for formatting, users, and spelling mistakes
|
|
||||||
* Add missing typescript definition for j2xParser
|
|
||||||
* refactoring: change filenames
|
|
||||||
3.11.1 / 2018-06-05
|
|
||||||
* fix #93: read the text after self closing tag
|
|
||||||
3.11.0 / 2018-05-20
|
|
||||||
* return defaultOptions if there are not options in buildOptions function
|
|
||||||
* added localeRange declaration in parser.d.ts
|
|
||||||
* Added support of cyrillic characters in validator XML
|
|
||||||
* fixed bug in validator work when XML data with byte order marker
|
|
||||||
3.10.0 / 2018-05-13
|
|
||||||
* Added support of cyrillic characters in parsing XML to JSON
|
|
||||||
3.9.11 / 2018-05-09
|
|
||||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/80 fix nimn chars
|
|
||||||
* update package information
|
|
||||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/86: json 2 xml parser : property with null value should be parsed to self closing tag.
|
|
||||||
* update online demo
|
|
||||||
* revert zombiejs to old version to support old version of node
|
|
||||||
* update dependencies
|
|
||||||
3.3.10 / 2018-04-23
|
|
||||||
* fix #77 : parse even if closing tag has space before '>'
|
|
||||||
* include all css & js lib in demo app
|
|
||||||
* remove babel dependencies until needed
|
|
||||||
3.3.9 / 2018-04-18
|
|
||||||
* fix #74 : TS2314 TypeScript compiler error
|
|
||||||
3.3.8 / 2018-04-17
|
|
||||||
* fix #73 : IE doesn't support Object.assign
|
|
||||||
3.3.7 / 2018-04-14
|
|
||||||
* fix: use let insted of const in for loop of validator
|
|
||||||
* Merge pull request
|
|
||||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/71 from bb/master
|
|
||||||
first draft of typings for typescript
|
|
||||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/69
|
|
||||||
* Merge pull request
|
|
||||||
https://github.com/NaturalIntelligence/fast-xml-parser/issues/70 from bb/patch-1
|
|
||||||
fix some typos in readme
|
|
||||||
3.3.6 / 2018-03-21
|
|
||||||
* change arrow functions to full notation for IE compatibility
|
|
||||||
3.3.5 / 2018-03-15
|
|
||||||
* fix https://github.com/NaturalIntelligence/fast-xml-parser/issues/67 : attrNodeName invalid behavior
|
|
||||||
* fix: remove decodeHTML char condition
|
|
||||||
3.3.4 / 2018-03-14
|
|
||||||
* remove dependency on "he" package
|
|
||||||
* refactor code to separate methods in separate files.
|
|
||||||
* draft code for transforming XML to json string. It is not officially documented due to performance issue.
|
|
||||||
3.3.0 / 2018-03-05
|
|
||||||
* use common default options for XML parsing for consistency. And add `parseToNimn` method.
|
|
||||||
* update nexttodo
|
|
||||||
* update README about XML to Nimn transformation and remove special notes about 3.x release
|
|
||||||
* update CONTRIBUTING.ms mentioning nexttodo
|
|
||||||
* add negative case for XML PIs
|
|
||||||
* validate xml processing instruction tags https://github.com/NaturalIntelligence/fast-xml-parser/issues/62
|
|
||||||
* nimndata: handle array with object
|
|
||||||
* nimndata: node with nested node and text node
|
|
||||||
* nimndata: handle attributes and text node
|
|
||||||
* nimndata: add options, handle array
|
|
||||||
* add xml to nimn data converter
|
|
||||||
* x2j: direct access property with tagname
|
|
||||||
* update changelog
|
|
||||||
* fix validator when single quote presents in value enclosed with double quotes or vice versa
|
|
||||||
* Revert "remove unneded nimnjs dependency, move opencollective to devDependencies and replace it
|
|
||||||
with more light opencollective-postinstall"
|
|
||||||
This reverts commit d47aa7181075d82db4fee97fd8ea32b056fe3f46.
|
|
||||||
* Merge pull request: https://github.com/NaturalIntelligence/fast-xml-parser/issues/63 from HaroldPutman/suppress-undefined
|
|
||||||
Keep undefined nodes out of the XML output : This is useful when you are deleting nodes from the JSON and rewriting XML.
|
|
||||||
3.2.4 / 2018-03-01
|
|
||||||
* fix #59 fix in validator when open quote presents in attribute value
|
|
||||||
* Create nexttodo.md
|
|
||||||
* exclude static from bitHound tests
|
|
||||||
* add package lock
|
|
||||||
3.2.3 / 2018-02-28
|
|
||||||
* Merge pull request from Delagen/master: fix namespaces can contain the same characters as xml names
|
|
||||||
3.2.2 / 2018-02-22
|
|
||||||
* fix: attribute xmlns should not be removed if ignoreNameSpace is false
|
|
||||||
* create CONTRIBUTING.md
|
|
||||||
3.2.1 / 2018-02-17
|
|
||||||
* fix: empty attribute should be parsed
|
|
||||||
3.2.0 / 2018-02-16
|
|
||||||
* Merge pull request : Dev to Master
|
|
||||||
* Update README and version
|
|
||||||
* j2x:add performance test
|
|
||||||
* j2x: Remove extra empty line before closing tag
|
|
||||||
* j2x: suppress empty nodes to self closing node if configured
|
|
||||||
* j2x: provide option to give indentation depth
|
|
||||||
* j2x: make optional formatting
|
|
||||||
* j2x: encodeHTMLchat
|
|
||||||
* j2x: handle cdata tag
|
|
||||||
* j2x: handle grouped attributes
|
|
||||||
* convert json to xml
|
|
||||||
- nested object
|
|
||||||
- array
|
|
||||||
- attributes
|
|
||||||
- text value
|
|
||||||
* small refactoring
|
|
||||||
* Merge pull request: Update cli.js to let user validate XML file or data
|
|
||||||
* Add option for rendering CDATA as separate property
|
|
||||||
3.0.1 / 2018-02-09
|
|
||||||
* fix CRLF: replace it with single space in attributes value only.
|
|
||||||
3.0.0 / 2018-02-08
|
|
||||||
* change online tool with new changes
|
|
||||||
* update info about new options
|
|
||||||
* separate tag value processing to separate function
|
|
||||||
* make HTML decoding optional
|
|
||||||
* give an option to allow boolean attributes
|
|
||||||
* change cli options as per v3
|
|
||||||
* Correct comparison table format on README
|
|
||||||
* update v3 information
|
|
||||||
* some performance improvement changes
|
|
||||||
* Make regex object local to the method and move some common methods to util
|
|
||||||
* Change parser to
|
|
||||||
- handle multiple instances of CDATA
|
|
||||||
- make triming of value optionals
|
|
||||||
- HTML decode attribute and text value
|
|
||||||
- refactor code to separate files
|
|
||||||
* Ignore newline chars without RE (in validator)
|
|
||||||
* validate for XML prolog
|
|
||||||
* Validate DOCTYPE without RE
|
|
||||||
* Update validator to return error response
|
|
||||||
* Update README to add detail about V3
|
|
||||||
* Separate xmlNode model class
|
|
||||||
* include vscode debug config
|
|
||||||
* fix for repeated object
|
|
||||||
* fix attribute regex for boolean attributes
|
|
||||||
* Fix validator for invalid attributes
|
|
||||||
2.9.4 / 2018-02-02
|
|
||||||
* Merge pull request: Decode HTML characters
|
|
||||||
* refactor source folder name
|
|
||||||
* ignore bundle / browser js to be published to npm
|
|
||||||
2.9.3 / 2018-01-26
|
|
||||||
* Merge pull request: Correctly remove CRLF line breaks
|
|
||||||
* Enable to parse attribute in online editor
|
|
||||||
* Fix testing demo app test
|
|
||||||
* Describe parsing options
|
|
||||||
* Add options for online demo
|
|
||||||
2.9.2 / 2018-01-18
|
|
||||||
* Remove check if tag starting with "XML"
|
|
||||||
* Fix: when there are spaces before / after CDATA
|
|
||||||
|
|
||||||
2.9.1 / 2018-01-16
|
|
||||||
* Fix: newline should be replaced with single space
|
|
||||||
* Fix: for single and multiline comments
|
|
||||||
* validate xml with CDATA
|
|
||||||
* Fix: the issue when there is no space between 2 attributes
|
|
||||||
* Fix: https://github.com/NaturalIntelligence/fast-xml-parser/issues/33: when there is newline char in attr val, it doesn't parse
|
|
||||||
* Merge pull request: fix ignoreNamespace
|
|
||||||
* fix: don't wrap attributes if only namespace attrs
|
|
||||||
* fix: use portfinder for run tests, update deps
|
|
||||||
* fix: don't treat namespaces as attributes when ignoreNamespace enabled
|
|
||||||
|
|
||||||
2.9.0 / 2018-01-10
|
|
||||||
* Rewrite the validator to handle large files.
|
|
||||||
Ignore DOCTYPE validation.
|
|
||||||
* Fix: When attribute value has equal sign
|
|
||||||
|
|
||||||
2.8.3 / 2017-12-15
|
|
||||||
* Fix: when a tag has value along with subtags
|
|
||||||
|
|
||||||
2.8.2 / 2017-12-04
|
|
||||||
* Fix value parsing for IE
|
|
||||||
|
|
||||||
2.8.1 / 2017-12-01
|
|
||||||
* fix: validator should return false instead of err when invalid XML
|
|
||||||
|
|
||||||
2.8.0 / 2017-11-29
|
|
||||||
* Add CLI option to ignore value conversion
|
|
||||||
* Fix variable name when filename is given on CLI
|
|
||||||
* Update CLI help text
|
|
||||||
* Merge pull request: xml2js: Accept standard input
|
|
||||||
* Test Node 8
|
|
||||||
* Update dependencies
|
|
||||||
* Bundle readToEnd
|
|
||||||
* Add ability to read from standard input
|
|
||||||
|
|
||||||
2.7.4 / 2017-09-22
|
|
||||||
* Merge pull request: Allow wrap attributes with subobject to compatible with other parsers output
|
|
||||||
|
|
||||||
2.7.3 / 2017-08-02
|
|
||||||
* fix: handle CDATA with regx
|
|
||||||
|
|
||||||
2.7.2 / 2017-07-30
|
|
||||||
* Change travis config for yarn caching
|
|
||||||
* fix validator: when tag property is same as array property
|
|
||||||
* Merge pull request: Failing test case in validator for valid SVG
|
|
||||||
|
|
||||||
2.7.1 / 2017-07-26
|
|
||||||
* Fix: Handle val 0
|
|
||||||
|
|
||||||
2.7.0 / 2017-07-25
|
|
||||||
* Fix test for arrayMode
|
|
||||||
* Merge pull request: Add arrayMode option to parse any nodes as arrays
|
|
||||||
|
|
||||||
2.6.0 / 2017-07-14
|
|
||||||
* code improvement
|
|
||||||
* Add unit tests for value conversion for attr
|
|
||||||
* Merge pull request: option of an attribute value conversion to a number (textAttrConversion) the same way as the textNodeConversion option does. Default value is false.
|
|
||||||
|
|
||||||
2.5.1 / 2017-07-01
|
|
||||||
* Fix XML element name pattern
|
|
||||||
* Fix XML element name pattern while parsing
|
|
||||||
* Fix validation for xml tag element
|
|
||||||
|
|
||||||
2.5.0 / 2017-06-25
|
|
||||||
* Improve Validator performance
|
|
||||||
* update attr matching regex
|
|
||||||
* Add perf tests
|
|
||||||
* Improve atrr regex to handle all cases
|
|
||||||
|
|
||||||
2.4.4 / 2017-06-08
|
|
||||||
* Bug fix: when an attribute has single or double quote in value
|
|
||||||
|
|
||||||
2.4.3 / 2017-06-05
|
|
||||||
* Bug fix: when multiple CDATA tags are given
|
|
||||||
* Merge pull request: add option "textNodeConversion"
|
|
||||||
* add option "textNodeConversion"
|
|
||||||
|
|
||||||
2.4.1 / 2017-04-14
|
|
||||||
* fix tests
|
|
||||||
* Bug fix: preserve initial space of node value
|
|
||||||
* Handle CDATA
|
|
||||||
|
|
||||||
2.3.1 / 2017-03-15
|
|
||||||
* Bug fix: when single self closing tag
|
|
||||||
* Merge pull request: fix .codeclimate.yml
|
|
||||||
* Update .codeclimate.yml - Fixed config so it does not error anymore.
|
|
||||||
* Update .codeclimate.yml
|
|
||||||
|
|
||||||
2.3.0 / 2017-02-26
|
|
||||||
* Code improvement
|
|
||||||
* add bithound config
|
|
||||||
* Update usage
|
|
||||||
* Update travis to generate bundle js before running tests
|
|
||||||
* 1.Browserify, 2. add more tests for validator
|
|
||||||
* Add validator
|
|
||||||
* Fix CLI default parameter bug
|
|
||||||
|
|
||||||
2.2.1 / 2017-02-05
|
|
||||||
* Bug fix: CLI default option
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
# Thanks
|
|
||||||
I would like to thank you for your valuable time and effort and applogies if this PR is rejected due to any reason.
|
|
||||||
|
|
||||||
This repository is written with the aim of providing high performance not in terms of speed only but comfortability of the user as well.
|
|
||||||
|
|
||||||
If your change is not a bug fix please check **nexttodo.md** before implementing any new feature.
|
|
||||||
|
|
||||||
## No rights are resserved
|
|
||||||
|
|
||||||
Your contribution is valuable. We try to mention your name on README with the avatar. We can't promise to pay you for your contribution.
|
|
||||||
|
|
||||||
### DoD
|
|
||||||
Here is the check list to publish any change
|
|
||||||
|
|
||||||
* Changes are not half implemented due to the library limitation or any other reason.
|
|
||||||
* Changes are well discussed by raising github issue. So they are well known by other contributers and users
|
|
||||||
* Echoing the above point. The purpose / goal for the PR should be mentioned in the description.
|
|
||||||
* Multiple unrelated changes should not be clubbed in single PR.
|
|
||||||
* Please run perf tests `node benchmark\perfTest3.js` before and after the changes. And mention it in PR description.
|
|
||||||
* If you are adding any dependency (specially if it is not the dev dependency) please check that
|
|
||||||
* it is not dependent on other language packages like c/c++
|
|
||||||
* the package is not very old, very new, discontinued, or has any vulnerability etc.
|
|
||||||
* please check the performance and size of package
|
|
||||||
* please check alternate available options
|
|
||||||
* Please write tests for the new changes
|
|
||||||
* Don't forget to write tests for negative cases
|
|
||||||
* Don't comment existing test case.
|
|
||||||
|
|
||||||
Changes need to do be done by owner
|
|
||||||
* Increase the version number
|
|
||||||
* Update the change log & README if required
|
|
||||||
* Generate the browser bundle
|
|
||||||
* Release in github and publish to npm
|
|
||||||
|
|
||||||
Note that publishing changes or accepting any PR may take time. So please keep patience.
|
|
||||||
|
|
||||||
### Guidelines for first time contributors
|
|
||||||
|
|
||||||
* https://github.com/Roshanjossey/first-contributions
|
|
||||||
* **Don't stretch**. If you complete an issue in long time, there is a possibility that other developers finish their part and you face code conflicts which may increase code complexity for you. So it is always good to complete an issue ASAP.
|
|
||||||
* Please refrain to work on multiple issues marked with "first-timers-only" in the same repo. Ask and help your friends and colleagues to attempt rest issues.
|
|
||||||
* Please claim the issue and clear your doubts before raising PR. So other users will not start working on the same issue.
|
|
||||||
* Mention the issue number either in PR detail or in commit message.
|
|
||||||
* Keep increasing the level of challenge.
|
|
||||||
* Don't hesitate to question on github issue or on twitter.
|
|
||||||
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"tests": "./spec/*_spec.js",
|
|
||||||
"timeout": 10000,
|
|
||||||
"output": "./output",
|
|
||||||
"helpers": {
|
|
||||||
"WebDriverIO": {
|
|
||||||
"url": "http://localhost",
|
|
||||||
"browser": "chrome"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"include": {
|
|
||||||
"I": "./steps_file.js"
|
|
||||||
},
|
|
||||||
"bootstrap": false,
|
|
||||||
"mocha": {},
|
|
||||||
"name": "fxp"
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
* check test coverage and write necessary tests
|
|
||||||
* validate XML stream data
|
|
||||||
* Fix jTox for json array. Not sure if a bug exist.
|
|
||||||
* generate separate and combined browser bundle for xml -> nimn, xml -> json , json -> xml
|
|
||||||
* Es6 to es5 migration without workaround.
|
|
||||||
* Parse JSON string to XML. Currently it transforms JSON object to XML. Partially done. Need to work on performance.
|
|
||||||
* build properties only once
|
|
||||||
* XML to JSON ML : https://en.wikipedia.org/wiki/JsonML
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Jasmine Tests",
|
|
||||||
"program": "${workspaceFolder}/node_modules/jasmine/bin/jasmine.js",
|
|
||||||
"args": [
|
|
||||||
"${workspaceFolder}/test/dateparser_test.js"
|
|
||||||
],
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@ -1,139 +0,0 @@
|
|||||||
var monthInitials = ["J","F","M","A","m","j","U","a","S","O","N","D"];
|
|
||||||
|
|
||||||
var initials = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
|
|
||||||
var timeZone = [
|
|
||||||
12*60,
|
|
||||||
11*60,
|
|
||||||
10*60,
|
|
||||||
9.5*60,
|
|
||||||
9*60,
|
|
||||||
8*60,
|
|
||||||
7*60,
|
|
||||||
6*60,
|
|
||||||
5*60,
|
|
||||||
4*60,
|
|
||||||
3.5*60,
|
|
||||||
3*60,
|
|
||||||
2*60,
|
|
||||||
1*60,
|
|
||||||
0*60,
|
|
||||||
-1*60,
|
|
||||||
-2*60,
|
|
||||||
-3*60,
|
|
||||||
-3.5*60,
|
|
||||||
-4*60,
|
|
||||||
-4.5*60,
|
|
||||||
-5*60,
|
|
||||||
-5.5*60,
|
|
||||||
-5.75*60,
|
|
||||||
-6*60,
|
|
||||||
-6.5*60,
|
|
||||||
-7*60,
|
|
||||||
-8*60,
|
|
||||||
-8.5*60,
|
|
||||||
-8.75*60,
|
|
||||||
-9*60,
|
|
||||||
-9.5*60,
|
|
||||||
-10*60,
|
|
||||||
-10.5*60,
|
|
||||||
-11*60,
|
|
||||||
-12*60,
|
|
||||||
-12.75*60,
|
|
||||||
-13*60,
|
|
||||||
-14*60
|
|
||||||
];
|
|
||||||
|
|
||||||
function parseToUTC(dtObj, includeDate, includeCentury, includeTime){
|
|
||||||
if(typeof dtObj === "string"){
|
|
||||||
dtObj = new Date(dtObj);
|
|
||||||
}
|
|
||||||
var dtStr = "";
|
|
||||||
if(includeCentury){
|
|
||||||
dtStr += char(Math.floor(dtObj.getUTCFullYear()/100)) ;
|
|
||||||
}
|
|
||||||
if(includeDate){//3
|
|
||||||
//year
|
|
||||||
dtStr += char(dtObj.getUTCFullYear()%100);
|
|
||||||
//month
|
|
||||||
dtStr += monthInitials[dtObj.getUTCMonth()];
|
|
||||||
//date
|
|
||||||
dtStr += initials[dtObj.getUTCDate()]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(includeTime){//5
|
|
||||||
//h
|
|
||||||
dtStr += initials[dtObj.getUTCHours()]
|
|
||||||
//m
|
|
||||||
dtStr += initials[dtObj.getUTCMinutes()];
|
|
||||||
//s
|
|
||||||
dtStr += initials[dtObj.getUTCSeconds()];
|
|
||||||
//ms
|
|
||||||
var ms = dtObj.getUTCMilliseconds();
|
|
||||||
dtStr += char(Math.floor(ms/10)) ;
|
|
||||||
dtStr += char(ms%10) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//zone
|
|
||||||
//if(includeZone){//1
|
|
||||||
dtStr += initials[timeZone.indexOf(dtObj.getTimezoneOffset() ) ]
|
|
||||||
//}
|
|
||||||
return dtStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {*} dtStr
|
|
||||||
* @param {*} includeDate
|
|
||||||
* @param {*} includeCentury
|
|
||||||
* @param {*} includeTime
|
|
||||||
* @param {*} includeZone
|
|
||||||
*/
|
|
||||||
function parseBackUTC(dtStr,includeDate, includeCentury, includeTime){
|
|
||||||
|
|
||||||
var century = 0;
|
|
||||||
var startFrom = 0;
|
|
||||||
var Y = 0, M = 0, D = 0, h = 0, m = 0, s = 0, ms = 0, z = 0;
|
|
||||||
if(includeCentury){//1st digit is century
|
|
||||||
century = 100 * ascii(dtStr[startFrom++]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(includeDate){
|
|
||||||
Y = century + ascii(dtStr[startFrom++]);
|
|
||||||
M = monthInitials.indexOf(dtStr[startFrom++]);
|
|
||||||
D = initials.indexOf(dtStr[startFrom++])
|
|
||||||
//startFrom += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(includeTime){
|
|
||||||
h = initials.indexOf(dtStr[startFrom++]);
|
|
||||||
m = initials.indexOf(dtStr[startFrom++]);
|
|
||||||
s = initials.indexOf(dtStr[startFrom++]);
|
|
||||||
|
|
||||||
ms = ascii(dtStr[startFrom++])*10 + ascii(dtStr[startFrom++]);
|
|
||||||
//startFrom += 5;
|
|
||||||
}
|
|
||||||
var dt = new Date(Y,M,D,h,m,s,ms);
|
|
||||||
//if(includeZone){
|
|
||||||
z = timeZone[initials.indexOf(dtStr[startFrom])];
|
|
||||||
dt.setTime(dt.getTime() - z*60*1000);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function ascii(ch){
|
|
||||||
return ch.charCodeAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* converts a ASCII number into equivalant ASCII char
|
|
||||||
* @param {number} a
|
|
||||||
* @returns ASCII char
|
|
||||||
*/
|
|
||||||
var char = function (a){
|
|
||||||
return String.fromCharCode(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.parse = parseToUTC;
|
|
||||||
exports.parseBack = parseBackUTC;
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"nimn-date-parser@1.0.0",
|
|
||||||
"C:\\dev\\repos\\actions\\setup-dotnet"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "nimn-date-parser@1.0.0",
|
|
||||||
"_id": "nimn-date-parser@1.0.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-1Nf+x3EeMvHUiHsVuEhiZnwA8RMeOBVTQWfB1S2n9+i6PYCofHd2HRMD+WOHIHYshy4T4Gk8wQoCol7Hq3av8Q==",
|
|
||||||
"_location": "/nimn-date-parser",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "nimn-date-parser@1.0.0",
|
|
||||||
"name": "nimn-date-parser",
|
|
||||||
"escapedName": "nimn-date-parser",
|
|
||||||
"rawSpec": "1.0.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.0.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/nimnjs"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/nimn-date-parser/-/nimn-date-parser-1.0.0.tgz",
|
|
||||||
"_spec": "1.0.0",
|
|
||||||
"_where": "C:\\dev\\repos\\actions\\setup-dotnet",
|
|
||||||
"author": {
|
|
||||||
"name": "Amit Gupta",
|
|
||||||
"url": "https://github.com/amitguptagwl"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/nimndata/nimnjs-date-parser/issues"
|
|
||||||
},
|
|
||||||
"description": "Compress date for nimnjs",
|
|
||||||
"devDependencies": {
|
|
||||||
"jasmine": "^3.0.0",
|
|
||||||
"jasmine-core": "^2.99.1"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"test": "tests"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/nimndata/nimnjs-date-parser#readme",
|
|
||||||
"keywords": [
|
|
||||||
"nimn",
|
|
||||||
"nimnjs",
|
|
||||||
"date",
|
|
||||||
"parser"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "dateparser.js",
|
|
||||||
"name": "nimn-date-parser",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/nimndata/nimnjs-date-parser.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "jasmine tests/*test.js"
|
|
||||||
},
|
|
||||||
"version": "1.0.0"
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
var parser = require("../dateparser.js");
|
|
||||||
|
|
||||||
describe("Date parser", function () {
|
|
||||||
it(" should parse and parseback full date", function () {
|
|
||||||
|
|
||||||
var dt = new Date("Mon Feb 26 2018 17:42:17 GMT+0530 (IST)");
|
|
||||||
//var dt = new Date("Tue May 15 2012 05:45:40 GMT-0500");
|
|
||||||
//console.log(dt);
|
|
||||||
|
|
||||||
var nimnDt = parser.parse(dt,true,true,true);
|
|
||||||
console.log(nimnDt);
|
|
||||||
|
|
||||||
var dt2 = parser.parseBack(nimnDt,true,true,true);
|
|
||||||
//console.log(dt2);
|
|
||||||
|
|
||||||
expect(dt).toEqual(dt2);
|
|
||||||
expect(10).toEqual(nimnDt.length);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it(" should parse and parseback only date part", function () {
|
|
||||||
|
|
||||||
var dt = new Date();
|
|
||||||
//console.log(dt);
|
|
||||||
|
|
||||||
var nimnDt = parser.parse(dt,true,false);
|
|
||||||
//console.log(nimnDt);
|
|
||||||
|
|
||||||
var dt2 = parser.parseBack(nimnDt,true,false);
|
|
||||||
//console.log(dt2);
|
|
||||||
|
|
||||||
expect(4).toEqual(nimnDt.length);
|
|
||||||
expect(dt.getFullYear()%100).toEqual(dt2.getFullYear()%100);
|
|
||||||
expect(dt.getMonth()).toEqual(dt2.getMonth());
|
|
||||||
expect(dt.getDate()).toEqual(dt2.getDate());
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it(" should parse and parseback date part with century", function () {
|
|
||||||
var dt = new Date();
|
|
||||||
//console.log(dt);
|
|
||||||
|
|
||||||
var nimnDt = parser.parse(dt,true,true);
|
|
||||||
//console.log(nimnDt);
|
|
||||||
|
|
||||||
var dt2 = parser.parseBack(nimnDt,true,true);
|
|
||||||
//console.log(dt2);
|
|
||||||
|
|
||||||
expect(5).toEqual(nimnDt.length);
|
|
||||||
expect(dt.getFullYear()).toEqual(dt2.getFullYear());
|
|
||||||
expect(dt.getMonth()).toEqual(dt2.getMonth());
|
|
||||||
expect(dt.getDate()).toEqual(dt2.getDate());
|
|
||||||
});
|
|
||||||
|
|
||||||
it(" should parse and parseback time", function () {
|
|
||||||
var dt = new Date();
|
|
||||||
//console.log(dt);
|
|
||||||
|
|
||||||
var nimnDt = parser.parse(dt,false,false,true);
|
|
||||||
//console.log(nimnDt);
|
|
||||||
|
|
||||||
var dt2 = parser.parseBack(nimnDt,false,false,true);
|
|
||||||
//console.log(dt2);
|
|
||||||
|
|
||||||
expect(6).toEqual(nimnDt.length);
|
|
||||||
expect(dt.getHours()).toEqual(dt2.getHours());
|
|
||||||
expect(dt.getMinutes()).toEqual(dt2.getMinutes());
|
|
||||||
expect(dt.getSeconds()).toEqual(dt2.getSeconds());
|
|
||||||
expect(dt.getMilliseconds()).toEqual(dt2.getMilliseconds());
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
# nimnjs-schema-builder
|
|
||||||
Build schema from JS object or JSON to feed into [nimnjs](https://github.com/nimndata/nimnjs-node).
|
|
||||||
|
|
||||||
|
|
||||||
## Usages
|
|
||||||
|
|
||||||
First install or add to your npm package
|
|
||||||
```
|
|
||||||
$npm install nimn_schema_builder
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
var builder = require("nimn_schema_builder");
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
name : "amit",
|
|
||||||
age : 32,
|
|
||||||
human : true,
|
|
||||||
projects : [
|
|
||||||
{
|
|
||||||
name: "some",
|
|
||||||
from: new Date(),
|
|
||||||
//to: null,
|
|
||||||
decription : "some long description"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
var schema = builder.build(data);
|
|
||||||
|
|
||||||
/*
|
|
||||||
var schema = {
|
|
||||||
name : "string",
|
|
||||||
age : "number",
|
|
||||||
human : "boolean",
|
|
||||||
projects : [
|
|
||||||
{
|
|
||||||
name: "string",
|
|
||||||
from: "date",
|
|
||||||
decription : "string"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also use it in browser from [dist](dist/nimn-schema-builder.js) folder.
|
|
||||||
|
|
||||||
Check the [demo](https://nimndata.github.io/nimnjs-schema-builder/) for instant use.
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* Build Schema for nimnification of JSON data
|
|
||||||
* @param {*} jsObj
|
|
||||||
*/
|
|
||||||
function buildSchema(jsObj){
|
|
||||||
var type = typeOf(jsObj);
|
|
||||||
switch(type){
|
|
||||||
case "array":
|
|
||||||
return [buildSchema(jsObj[0])];
|
|
||||||
case "object":
|
|
||||||
var schema = { };
|
|
||||||
var keys = Object.keys(jsObj);
|
|
||||||
for(var i in keys){
|
|
||||||
var key = keys[i];
|
|
||||||
/* if(key === null || typeof key === "undefined"){//in case of null or undefined, take sibling's type
|
|
||||||
if(keys[i+1] ){
|
|
||||||
schema[key] = buildSchema(jsObj[keys[i+1]]);
|
|
||||||
}else if(keys[i-1]){
|
|
||||||
schema[key] = buildSchema(jsObj[keys[i-1]]);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} */
|
|
||||||
schema[key] = buildSchema(jsObj[key]);
|
|
||||||
}
|
|
||||||
return schema;
|
|
||||||
case "string":
|
|
||||||
case "number":
|
|
||||||
case "date":
|
|
||||||
case "boolean":
|
|
||||||
return type;
|
|
||||||
default:
|
|
||||||
throw Error("Unacceptable type : " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function typeOf(obj){
|
|
||||||
if(obj === null) return "null";
|
|
||||||
else if(Array.isArray(obj)) return "array";
|
|
||||||
else if(obj instanceof Date) return "date";
|
|
||||||
else return typeof obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.build = buildSchema;
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.nimnSchemaBuilder = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build Schema for nimnification of JSON data
|
|
||||||
* @param {*} jsObj
|
|
||||||
*/
|
|
||||||
function buildSchema(jsObj){
|
|
||||||
var type = typeOf(jsObj);
|
|
||||||
switch(type){
|
|
||||||
case "array":
|
|
||||||
return [buildSchema(jsObj[0])];
|
|
||||||
case "object":
|
|
||||||
var schema = { };
|
|
||||||
var keys = Object.keys(jsObj);
|
|
||||||
for(var i in keys){
|
|
||||||
var key = keys[i];
|
|
||||||
/* if(key === null || typeof key === "undefined"){//in case of null or undefined, take sibling's type
|
|
||||||
if(keys[i+1] ){
|
|
||||||
schema[key] = buildSchema(jsObj[keys[i+1]]);
|
|
||||||
}else if(keys[i-1]){
|
|
||||||
schema[key] = buildSchema(jsObj[keys[i-1]]);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} */
|
|
||||||
schema[key] = buildSchema(jsObj[key]);
|
|
||||||
}
|
|
||||||
return schema;
|
|
||||||
case "string":
|
|
||||||
case "number":
|
|
||||||
case "date":
|
|
||||||
case "boolean":
|
|
||||||
return type;
|
|
||||||
default:
|
|
||||||
throw Error("Unacceptable type : " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function typeOf(obj){
|
|
||||||
if(obj === null) return "null";
|
|
||||||
else if(Array.isArray(obj)) return "array";
|
|
||||||
else if(obj instanceof Date) return "date";
|
|
||||||
else return typeof obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.build = buildSchema;
|
|
||||||
},{}]},{},[1])(1)
|
|
||||||
});
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"nimn_schema_builder@1.1.0",
|
|
||||||
"C:\\dev\\repos\\actions\\setup-dotnet"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "nimn_schema_builder@1.1.0",
|
|
||||||
"_id": "nimn_schema_builder@1.1.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-DK5/B8CM4qwzG2URy130avcwPev4uO0ev836FbQyKo1ms6I9z/i6EJyiZ+d9xtgloxUri0W+5gfR8YbPq7SheA==",
|
|
||||||
"_location": "/nimn_schema_builder",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "nimn_schema_builder@1.1.0",
|
|
||||||
"name": "nimn_schema_builder",
|
|
||||||
"escapedName": "nimn_schema_builder",
|
|
||||||
"rawSpec": "1.1.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.1.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/nimnjs"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/nimn_schema_builder/-/nimn_schema_builder-1.1.0.tgz",
|
|
||||||
"_spec": "1.1.0",
|
|
||||||
"_where": "C:\\dev\\repos\\actions\\setup-dotnet",
|
|
||||||
"author": {
|
|
||||||
"name": "Amit Gupta",
|
|
||||||
"url": "https://github.com/amitguptagwl"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/nimndata/nimnjs-schema-builder/issues"
|
|
||||||
},
|
|
||||||
"description": "Build schema from JS object or JSON to feed into nimnjs",
|
|
||||||
"devDependencies": {
|
|
||||||
"browserify": "^16.1.0"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/nimndata/nimnjs-schema-builder#readme",
|
|
||||||
"keywords": [
|
|
||||||
"nimn",
|
|
||||||
"nimnjs",
|
|
||||||
"builder",
|
|
||||||
"schema"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "builder.js",
|
|
||||||
"name": "nimn_schema_builder",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/nimndata/nimnjs-schema-builder.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bundle": "browserify builder.js -s nimn-schema-builder -o dist/nimn-schema-builder.js"
|
|
||||||
},
|
|
||||||
"version": "1.1.0"
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Jasmine Tests",
|
|
||||||
"program": "${workspaceFolder}/node_modules/jasmine/bin/jasmine.js",
|
|
||||||
"args": [
|
|
||||||
"${workspaceFolder}/test/encode_test.js"
|
|
||||||
],
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
## Thanks
|
|
||||||
I would like to thank you for your valuable time and effort and applogies if this PR is rejected due to any reason.
|
|
||||||
|
|
||||||
Aim: Implementing Nimn specification so that Js object can be converted to nimn format.
|
|
||||||
|
|
||||||
### DoD
|
|
||||||
Here is the check list to publish any change
|
|
||||||
|
|
||||||
* Changes are not half implemented due to the library limitation or any other reason.
|
|
||||||
* Changes are well discussed by raising github issue. So they are well known by other contributers and users
|
|
||||||
* Echoing the above point. The purpose / goal for the PR should be mentioned in the description.
|
|
||||||
* Multiple unrelated changes should not be clubbed in single PR.
|
|
||||||
* If you are adding any dependency (specially if it is not the dev dependency) please check that
|
|
||||||
* it is not dependent on other language packages like c/c++
|
|
||||||
* the package is not very old or very new, discontinued, has any vulnerability etc.
|
|
||||||
* please check the performance and size of package
|
|
||||||
* please check alternate available options
|
|
||||||
* Please write tests for the new changes
|
|
||||||
* Don't forget to write tests for negative cases
|
|
||||||
* Don't comment existing test case.
|
|
||||||
|
|
||||||
Note that publishing changes or accepting any PR may take time. So please keep patience.
|
|
||||||
|
|
||||||
### Guidelines for first time contributors
|
|
||||||
|
|
||||||
* https://github.com/Roshanjossey/first-contributions
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 nimndata
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
# nimnjs-node
|
|
||||||
JS implementation of nimn specification. Highly Compressed JS object/JSON. 60% or more compressed than JSON, 40% or more compressed than msgpack
|
|
||||||
|
|
||||||
[](https://snyk.io/test/github/nimndata/nimnjs-node/)
|
|
||||||
[](https://travis-ci.org/nimndata/nimnjs-node/)
|
|
||||||
[](https://coveralls.io/github/nimndata/nimnjs-node/?branch=master)
|
|
||||||
[<img src="https://img.shields.io/badge/Try-me-blue.svg?colorA=FFA500&colorB=0000FF" alt="Try me"/>](https://nimndata.github.io/nimnjs-node/)
|
|
||||||
|
|
||||||
<a href="https://www.patreon.com/bePatron?u=9531404" data-patreon-widget-type="become-patron-button"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" width="200" /></a>
|
|
||||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KQJAX48SPUKNC"> <img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_92x26.png" alt="Stubmatic donate button"/></a>
|
|
||||||
|
|
||||||
<img align="right" src="static/img/nimnjs-logo.png" />
|
|
||||||
|
|
||||||
## Introduction
|
|
||||||
NIMN JS can parse JS object to nimn data and vice versa. See Nimn [specification](https://github.com/nimndata/spec) for more detail.
|
|
||||||
|
|
||||||
## Usages
|
|
||||||
First install or add to your npm package
|
|
||||||
```
|
|
||||||
$npm install nimnjs
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
var nimn = require("nimnjs");
|
|
||||||
|
|
||||||
var schema = {
|
|
||||||
"name": "string",
|
|
||||||
"age": "number",
|
|
||||||
"human": "boolean",
|
|
||||||
"projects": [{
|
|
||||||
"name": "string",
|
|
||||||
"decription": "string"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
var nimnInstance = new nimn();
|
|
||||||
nimnInstance.addSchema(schema);
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
"name" : "amit",
|
|
||||||
"age" : 32,
|
|
||||||
"human" : true,
|
|
||||||
"projects" : [
|
|
||||||
{
|
|
||||||
"name": "some",
|
|
||||||
"decription" : "some long description"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = nimnInstance.encode(data);//Æamitº32ÙÇÆsomeºsome long description
|
|
||||||
result = nimnInstance.decode(result);
|
|
||||||
expect(result).toEqual(data);
|
|
||||||
```
|
|
||||||
|
|
||||||
For date compression
|
|
||||||
```js
|
|
||||||
var nimnDateparser = require("nimn-date-parser");
|
|
||||||
//generate schema and data
|
|
||||||
var nimnInstance = new nimn();
|
|
||||||
nimnInstance.addDataHandler("date",function(val){
|
|
||||||
return nimnDateparser.parse(val,true,true,true)
|
|
||||||
},function(val){
|
|
||||||
return nimnDateparser.parseBack(val,true,true,true)
|
|
||||||
});
|
|
||||||
nimnInstance.addSchema(schema); //add after adding all data handlers
|
|
||||||
|
|
||||||
var nimndata = nimnInstance.encode(data);
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Encode enum type
|
|
||||||
```js
|
|
||||||
var nimnInstance = new nimn();
|
|
||||||
nimnInstance.addDataHandler("status",null,null,{
|
|
||||||
"M" : "Married",
|
|
||||||
"S" : "Single"
|
|
||||||
});
|
|
||||||
nimnInstance.addSchema(schema); //add after adding all data handlers
|
|
||||||
```
|
|
||||||
|
|
||||||
Just mark a data type
|
|
||||||
```js
|
|
||||||
var nimnInstance = new nimn();
|
|
||||||
nimnInstance.addDataHandler("image");
|
|
||||||
nimnInstance.addSchema(schema); //add after adding all data handlers
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Include [dist](dist/nimn.js) in your HTML to use it in browser.
|
|
||||||
|
|
||||||
|
|
||||||
Check the [demo](https://nimndata.github.io/nimnjs-node/) for instant use. It generates schema automatically with the help of [schema builder](https://github.com/nimndata/nimnjs-schema-builder) when sample json is provided.
|
|
||||||
|
|
||||||
|
|
||||||
## Support
|
|
||||||
I need your expert advice, and contribution to grow nimn (निम्न) so that it can support all mazor languages. Please join the [official organization](https://github.com/nimndata) on github to support it. And ask your friends, and colleagues to give it a try. It can not only save bandwidth but speed up communication, search and much more.
|
|
||||||
|
|
||||||
|
|
||||||
### Worth to mention
|
|
||||||
|
|
||||||
- **[imglab](https://github.com/NaturalIntelligence/imglab)** : Web based tool to label images for object. So that they can be used to train dlib or other object detectors. You can integrate 3rd party libraries for fast labeling.
|
|
||||||
- **[अनुमार्गक (anumargak)](https://github.com/NaturalIntelligence/anumargak)** : The fastest router for node web servers.
|
|
||||||
|
|
||||||
- [Stubmatic](https://github.com/NaturalIntelligence/Stubmatic) : A stub server to mock behaviour of HTTP(s) / REST / SOAP services.
|
|
||||||
- **[fastify-xml-body-parser](https://github.com/NaturalIntelligence/fastify-xml-body-parser/)** : Fastify plugin / module to parse XML payload / body into JS object using fast-xml-parser.
|
|
||||||
- [fast-lorem-ipsum](https://github.com/amitguptagwl/fast-lorem-ipsum) : Generate lorem ipsum words, sentences, paragraph very quickly.
|
|
||||||
- [Grapes](https://github.com/amitguptagwl/grapes) : Flexible Regular expression engine which can be applied on char stream. (under development)
|
|
||||||
- [fast XML Parser](https://github.com/amitguptagwl/fast-xml-parser) : Fastest pure js XML parser for xml to js/json and vice versa. And XML validation.
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"nimnjs@1.3.2",
|
|
||||||
"C:\\dev\\repos\\actions\\setup-dotnet"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "nimnjs@1.3.2",
|
|
||||||
"_id": "nimnjs@1.3.2",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-TIOtI4iqkQrUM1tiM76AtTQem0c7e56SkDZ7sj1d1MfUsqRcq2ZWQvej/O+HBTZV7u/VKnwlKTDugK/75IRPPw==",
|
|
||||||
"_location": "/nimnjs",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "nimnjs@1.3.2",
|
|
||||||
"name": "nimnjs",
|
|
||||||
"escapedName": "nimnjs",
|
|
||||||
"rawSpec": "1.3.2",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.3.2"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/fast-xml-parser"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/nimnjs/-/nimnjs-1.3.2.tgz",
|
|
||||||
"_spec": "1.3.2",
|
|
||||||
"_where": "C:\\dev\\repos\\actions\\setup-dotnet",
|
|
||||||
"author": {
|
|
||||||
"name": "Amit Gupta",
|
|
||||||
"url": "https://github.com/amitguptagwl"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/nimndata/nimnjs-node/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"nimn-date-parser": "^1.0.0",
|
|
||||||
"nimn_schema_builder": "^1.0.0"
|
|
||||||
},
|
|
||||||
"description": "Schema aware compression of JS object/JSON data. 60% more compressed than json",
|
|
||||||
"devDependencies": {
|
|
||||||
"benchmark": "^2.1.4",
|
|
||||||
"browserify": "^15.1.0",
|
|
||||||
"cbor": "^4.0.0",
|
|
||||||
"istanbul": "^0.4.5",
|
|
||||||
"jasmine": "^3.0.0",
|
|
||||||
"jasmine-core": "^2.99.1",
|
|
||||||
"msgpack": "^1.0.2",
|
|
||||||
"notepack.io": "^2.1.2"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/nimndata/nimnjs-node",
|
|
||||||
"keywords": [
|
|
||||||
"nimn",
|
|
||||||
"nimnjs",
|
|
||||||
"json",
|
|
||||||
"compress",
|
|
||||||
"parse",
|
|
||||||
"format",
|
|
||||||
"msgpack"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "src/nimn.js",
|
|
||||||
"name": "nimnjs",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/nimndata/nimnjs-node.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"bundle": "browserify src/nimn.js -s nimn -o dist/nimn.js",
|
|
||||||
"coverage": "istanbul cover -x \"tests/*test.js\" jasmine tests/*test.js;",
|
|
||||||
"coverage:check": "istanbul check-coverage --branch 90 --statement 90",
|
|
||||||
"test": "jasmine tests/*test.js"
|
|
||||||
},
|
|
||||||
"version": "1.3.2"
|
|
||||||
}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string} dataType
|
|
||||||
* @param {function} parse
|
|
||||||
* @param {function} parseBack
|
|
||||||
* @param {object} charset
|
|
||||||
* @param {boolean} treatAsUnique
|
|
||||||
*/
|
|
||||||
function DataHandler(dataType, /* parse, parseBack, */ charset,treatAsUnique){
|
|
||||||
this.dataType = dataType;
|
|
||||||
//parse || (this.parse = parse);
|
|
||||||
//parseBack || (this.parseBack = parseBack);
|
|
||||||
if(charset){
|
|
||||||
//this.hasFixedInstances = true;
|
|
||||||
this.char2val = charset;
|
|
||||||
this.val2char = {};
|
|
||||||
var keys = Object.keys(charset);
|
|
||||||
for(var i in keys){
|
|
||||||
var val = charset[keys[i]];
|
|
||||||
this.val2char[val] = keys[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.charcodes = Object.keys(charset);
|
|
||||||
}
|
|
||||||
if(treatAsUnique){
|
|
||||||
this.hasFixedInstances = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//this.treatAsUnique = treatAsUnique;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataHandler.prototype.parse = function(a){
|
|
||||||
if(this.char2val){
|
|
||||||
return this.getCharCodeFor(a);
|
|
||||||
}else{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DataHandler.prototype.parseBack = function(a){
|
|
||||||
if(this.char2val){
|
|
||||||
return this.getValueOf(a);
|
|
||||||
}else{
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns an array of supported characters or empty array when it supportes dynamic data
|
|
||||||
*/
|
|
||||||
DataHandler.prototype.getCharCodes =function(){
|
|
||||||
return this.charcodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataHandler.prototype.getValueOf =function(chCode){
|
|
||||||
return this.char2val[chCode];
|
|
||||||
}
|
|
||||||
|
|
||||||
DataHandler.prototype.getCharCodeFor =function(value){
|
|
||||||
return this.val2char[value];
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = DataHandler;
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
var char = require("./util").char;
|
|
||||||
|
|
||||||
|
|
||||||
/* 176-178
|
|
||||||
180-190
|
|
||||||
198-208
|
|
||||||
219-223
|
|
||||||
*/
|
|
||||||
|
|
||||||
const chars= {
|
|
||||||
nilChar : char(176),
|
|
||||||
missingChar : char(201),
|
|
||||||
nilPremitive : char(175),
|
|
||||||
missingPremitive : char(200),
|
|
||||||
|
|
||||||
emptyChar : char(178),
|
|
||||||
emptyValue: char(177),//empty Premitive
|
|
||||||
|
|
||||||
boundryChar : char(179),
|
|
||||||
|
|
||||||
objStart: char(198),
|
|
||||||
arrStart: char(204),
|
|
||||||
arrayEnd: char(185),
|
|
||||||
}
|
|
||||||
|
|
||||||
const charsArr = [
|
|
||||||
chars.nilChar ,
|
|
||||||
chars.nilPremitive,
|
|
||||||
chars.missingChar,
|
|
||||||
chars.missingPremitive,
|
|
||||||
chars.boundryChar ,
|
|
||||||
chars.emptyChar,
|
|
||||||
chars.emptyValue,
|
|
||||||
chars.arrayEnd,
|
|
||||||
chars.objStart,
|
|
||||||
chars.arrStart
|
|
||||||
]
|
|
||||||
|
|
||||||
exports.chars = chars;
|
|
||||||
exports.charsArr = charsArr;
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
var chars = require("./chars").chars;
|
|
||||||
|
|
||||||
decoder.prototype._d = function(schema){
|
|
||||||
if(ifNil(this.currentChar())){
|
|
||||||
this.index++;
|
|
||||||
return null;
|
|
||||||
}else if(ifMissing(this.currentChar())){
|
|
||||||
this.index++;
|
|
||||||
return undefined;
|
|
||||||
}else if(typeof schema.type === "string"){//premitive
|
|
||||||
return this.readPremitiveValue(schema);
|
|
||||||
}else if(Array.isArray(schema)){
|
|
||||||
if(this.currentChar() === chars.emptyChar){
|
|
||||||
this.index++;
|
|
||||||
return [];
|
|
||||||
}else if(this.currentChar() !== chars.arrStart){
|
|
||||||
throw Error("Parsing error: Array start char was expected");
|
|
||||||
}else{
|
|
||||||
this.index++;//skip array start char
|
|
||||||
var item = schema[0];
|
|
||||||
var obj = []
|
|
||||||
do{
|
|
||||||
var r = this._d(item) ;
|
|
||||||
if(r !== undefined){
|
|
||||||
obj.push(r);
|
|
||||||
}
|
|
||||||
}while(this.dataToDecode[this.index] !== chars.arrayEnd);
|
|
||||||
++this.index;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}else{//object
|
|
||||||
if(this.currentChar() === chars.emptyChar){
|
|
||||||
this.index++;
|
|
||||||
return {};
|
|
||||||
}else if(this.currentChar() !== chars.objStart){
|
|
||||||
throw Error("Parsing error: Object start char was expected : " + this.currentChar());
|
|
||||||
}else{
|
|
||||||
this.index++;//skip object start char
|
|
||||||
var keys = Object.keys(schema);
|
|
||||||
var len = keys.length;
|
|
||||||
var obj = {};
|
|
||||||
for(var i=0; i< len; i++){
|
|
||||||
|
|
||||||
var r = this._d(schema[keys[i]]) ;
|
|
||||||
if(r !== undefined){
|
|
||||||
obj[keys[i]] = r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ifNil(ch){
|
|
||||||
return ch === chars.nilChar || ch === chars.nilPremitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ifMissing(ch){
|
|
||||||
return ch === chars.missingChar || ch === chars.missingPremitive;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* returns character index pointing to
|
|
||||||
*/
|
|
||||||
decoder.prototype.currentChar = function(){
|
|
||||||
return this.dataToDecode[this.index];
|
|
||||||
}
|
|
||||||
|
|
||||||
decoder.prototype.readPremitiveValue = function(schemaOfCurrentKey){
|
|
||||||
var val = this.readFieldValue(schemaOfCurrentKey);
|
|
||||||
if(this.currentChar() === chars.boundryChar) this.index++;
|
|
||||||
var dh = this.dataHandlers[schemaOfCurrentKey.type];
|
|
||||||
return dh.parseBack(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read characters until app supported char is found
|
|
||||||
*/
|
|
||||||
decoder.prototype.readFieldValue = function(schemaOfCurrentKey){
|
|
||||||
if(schemaOfCurrentKey.readUntil){
|
|
||||||
if(this.currentChar() === chars.emptyValue){
|
|
||||||
this.index++;
|
|
||||||
return "";
|
|
||||||
}else{
|
|
||||||
var until = schemaOfCurrentKey.readUntil;
|
|
||||||
var len = this.dataToDecode.length;
|
|
||||||
var start = this.index;
|
|
||||||
|
|
||||||
for(;this.index < len && until.indexOf(this.currentChar()) === -1;this.index++);
|
|
||||||
return this.dataToDecode.substr(start, this.index-start);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return this.dataToDecode[this.index++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
decoder.prototype.decode = function(objStr){
|
|
||||||
this.index= 0;
|
|
||||||
if(!objStr || typeof objStr !== "string" || objStr.length === 0) throw Error("input should be a valid string");
|
|
||||||
this.dataToDecode = objStr;
|
|
||||||
return this._d(this.schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
function decoder(schema,dataHandlers){
|
|
||||||
this.schema = schema;
|
|
||||||
this.dataHandlers = dataHandlers;
|
|
||||||
}
|
|
||||||
module.exports = decoder;
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
var chars = require("./chars").chars;
|
|
||||||
var appCharsArr = require("./chars").charsArr;
|
|
||||||
|
|
||||||
Encoder.prototype._e = function(jObj,e_schema){
|
|
||||||
if(typeof e_schema.type === "string"){//premitive
|
|
||||||
return this.getValue(jObj,e_schema.type);
|
|
||||||
}else{
|
|
||||||
var hasValidData = hasData(jObj);
|
|
||||||
if(hasValidData === true){
|
|
||||||
var str = "";
|
|
||||||
if(Array.isArray(e_schema)){
|
|
||||||
str += chars.arrStart;
|
|
||||||
var itemSchema = e_schema[0];
|
|
||||||
//var itemSchemaType = itemSchema;
|
|
||||||
var arr_len = jObj.length;
|
|
||||||
for(var arr_i=0;arr_i < arr_len;arr_i++){
|
|
||||||
var r = this._e(jObj[arr_i],itemSchema) ;
|
|
||||||
str = this.processValue(str,r);
|
|
||||||
}
|
|
||||||
str += chars.arrayEnd;//indicates that next item is not array item
|
|
||||||
}else{//object
|
|
||||||
str += chars.objStart;
|
|
||||||
var keys = Object.keys(e_schema);
|
|
||||||
for(var i in keys){
|
|
||||||
var key = keys[i];
|
|
||||||
var r = this._e(jObj[key],e_schema[key]) ;
|
|
||||||
str = this.processValue(str,r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}else{
|
|
||||||
return hasValidData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Encoder.prototype.processValue= function(str,r){
|
|
||||||
if(!this.isAppChar(r[0]) && !this.isAppChar(str[str.length -1])){
|
|
||||||
str += chars.boundryChar;
|
|
||||||
}
|
|
||||||
return str + r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {*} a
|
|
||||||
* @param {*} type
|
|
||||||
* @return {string} return either the parsed value or a special char representing the value
|
|
||||||
*/
|
|
||||||
Encoder.prototype.getValue= function(a,type){
|
|
||||||
switch(a){
|
|
||||||
case undefined: return chars.missingPremitive;
|
|
||||||
case null: return chars.nilPremitive;
|
|
||||||
case "": return chars.emptyValue;
|
|
||||||
default: return this.dataHandlers[type].parse(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given object is empty, null, or undefined. Returns true otherwise.
|
|
||||||
* @param {*} jObj
|
|
||||||
*/
|
|
||||||
function hasData(jObj){
|
|
||||||
if(jObj === undefined) return chars.missingChar;
|
|
||||||
else if(jObj === null) return chars.nilChar;
|
|
||||||
else if( jObj.length === 0 || Object.keys(jObj).length === 0){
|
|
||||||
return chars.emptyChar;
|
|
||||||
}else{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Encoder.prototype.isAppChar = function(ch){
|
|
||||||
return this.handledChars.indexOf(ch) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Encoder.prototype.encode = function(jObj){
|
|
||||||
return this._e(jObj,this.schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
function Encoder(schema,dHandlers, charArr){
|
|
||||||
this.dataHandlers = dHandlers;
|
|
||||||
this.handledChars = appCharsArr.slice();
|
|
||||||
this.handledChars = this.handledChars.concat(charArr);
|
|
||||||
|
|
||||||
this.schema = schema;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Encoder;
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* Verify if all the datahandlers are added given in schema.
|
|
||||||
* @param {*} schema
|
|
||||||
* @param {*} datahandlers
|
|
||||||
*/
|
|
||||||
var validateSchema = function(schema,datahandlers){
|
|
||||||
if(Array.isArray(schema)){
|
|
||||||
validateSchema(schema[0],datahandlers);
|
|
||||||
}else if(typeof schema === "object"){
|
|
||||||
var keys = Object.keys(schema);
|
|
||||||
var len = keys.length;
|
|
||||||
|
|
||||||
for(var i=0; i< len; i++){
|
|
||||||
var key = keys[i];
|
|
||||||
var nextKey = keys[i+1];
|
|
||||||
|
|
||||||
validateSchema(schema[key],datahandlers);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!datahandlers[schema]){
|
|
||||||
throw Error("You've forgot to add data handler for " + schema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.validateSchema = validateSchema;
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
var boolean = require("./parsers/boolean");
|
|
||||||
var numParser = require("./parsers/number");
|
|
||||||
var chars = require("./chars").chars;
|
|
||||||
var appCharsArr = require("./chars").charsArr;
|
|
||||||
var helper = require("./helper");
|
|
||||||
var schemaMarker = require("./schemaMarker");
|
|
||||||
var Decoder = require("./decoder");
|
|
||||||
var Encoder = require("./encoder");
|
|
||||||
var DataHandler = require("./DataHandler");
|
|
||||||
|
|
||||||
function nimn() {
|
|
||||||
this.handledChars = [];//appCharsArr.slice();
|
|
||||||
this.dataHandlers = {};
|
|
||||||
this.addDataHandler("boolean",null,null,boolean.charset,true);
|
|
||||||
//this.addDataHandler("boolean",boolean.parse,boolean.parseBack,boolean.charset,true);
|
|
||||||
this.addDataHandler("string");
|
|
||||||
this.addDataHandler("number",numParser.parse, numParser.parseBack);
|
|
||||||
this.addDataHandler("date");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method should be called once all the data handlers are registered.
|
|
||||||
* It updates internal schema based on given schema.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* {
|
|
||||||
* "field1" : "string",
|
|
||||||
* "field2" : "date",
|
|
||||||
* "field3" : {
|
|
||||||
* "field4" : "number"
|
|
||||||
* },
|
|
||||||
* "field5" : [ "image"],
|
|
||||||
* "field6" : [{ "field7" : "boolean"}]
|
|
||||||
* }
|
|
||||||
* @param {*} schema
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
nimn.prototype.addSchema= function(schema){
|
|
||||||
this.schema = JSON.parse(JSON.stringify(schema));
|
|
||||||
new schemaMarker(this.dataHandlers).markNextPossibleChars(this.schema);
|
|
||||||
//helper.validateSchema(schema,this.dataHandlers);
|
|
||||||
this.encoder = new Encoder(this.schema,this.dataHandlers,this.handledChars);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* You can update existnig handler od add new using this method.
|
|
||||||
* "string", "number", "boolean", and "date" are handled by default.
|
|
||||||
*
|
|
||||||
* charset should be set when given type should be treated as enum or fixed set of values
|
|
||||||
* @example
|
|
||||||
* //to map
|
|
||||||
* nimnInstance.addDataHandler("status",null,null,{ "R": "running", "S" : "stop", "I", "ready to run"},false)
|
|
||||||
* @example
|
|
||||||
* //just for identification
|
|
||||||
* nimnInstance.addDataHandler("image");
|
|
||||||
* @example
|
|
||||||
* //to compress more
|
|
||||||
* nimnInstance.addDataHandler("date", datecompressor.parse, datecompressor.parseBack);
|
|
||||||
* @param {string} type
|
|
||||||
* @param {function} parseWith - will be used by encoder to encode given type's value
|
|
||||||
* @param {function} parseBackWith - will be used by decoder to decode given type's value
|
|
||||||
* @param {Object} charset - map of charset and fixed values
|
|
||||||
* @param {boolean} [noBoundaryChar=false] - if true encoder will not separate given type's value with boundary char
|
|
||||||
*/
|
|
||||||
nimn.prototype.addDataHandler = function(type,parseWith,parseBackWith,charset,noBoundaryChar){
|
|
||||||
var dataHandler = new DataHandler(type,/* parseWith,parseBackWith, */charset,noBoundaryChar);
|
|
||||||
if(parseWith) dataHandler.parse = parseWith;
|
|
||||||
if(parseBackWith) dataHandler.parseBack = parseBackWith;
|
|
||||||
|
|
||||||
//unque charset don't require boundary char. Hence check them is they are already added
|
|
||||||
if(noBoundaryChar && charset){
|
|
||||||
var keys = Object.keys(charset);
|
|
||||||
|
|
||||||
for(var k in keys){
|
|
||||||
var ch = keys[k];
|
|
||||||
if(this.handledChars.indexOf(ch) !== -1 || appCharsArr.indexOf(ch) !== -1){
|
|
||||||
throw Error("DataHandler Error: "+ ch +" is not allowed. Either it is reserved or being used by another data handler");
|
|
||||||
}else{
|
|
||||||
this.handledChars.push(ch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dataHandlers[type] = dataHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
nimn.prototype.encode = function(jObj){
|
|
||||||
return this.encoder.encode(jObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
nimn.prototype.decode= function(encodedVal){
|
|
||||||
var decoder = new Decoder(this.schema,this.dataHandlers);
|
|
||||||
return decoder.decode(encodedVal);
|
|
||||||
}
|
|
||||||
module.exports = nimn;
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
var chars = require("../chars").chars;
|
|
||||||
var char = require("../util").char;
|
|
||||||
|
|
||||||
var yes = char(181);
|
|
||||||
var no = char(183);
|
|
||||||
|
|
||||||
booleanCharset = {};
|
|
||||||
booleanCharset[yes] = true;
|
|
||||||
booleanCharset[no] = false;
|
|
||||||
|
|
||||||
exports.charset = booleanCharset;
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
var chars = require("../chars").chars;
|
|
||||||
|
|
||||||
function parse(val){
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseBack(val){
|
|
||||||
if(val.indexOf(".") !== -1){
|
|
||||||
val = Number.parseFloat(val);
|
|
||||||
}else{
|
|
||||||
val = Number.parseInt(val,10);
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
exports.parse = parse;
|
|
||||||
exports.parseBack = parseBack;
|
|
||||||
@ -1,125 +0,0 @@
|
|||||||
var chars = require("./chars").chars;
|
|
||||||
var appCharsArr = require("./chars").charsArr;
|
|
||||||
|
|
||||||
schemaMarker.prototype._m = function(schema){
|
|
||||||
if(Array.isArray(schema)){
|
|
||||||
if(typeof schema[0] === "string"){
|
|
||||||
var itemSchema = {
|
|
||||||
type : schema[0]
|
|
||||||
}
|
|
||||||
this.setReadUntil(itemSchema, schema[0]);
|
|
||||||
schema[0] = itemSchema;//make it object so a function cant set it's value
|
|
||||||
if(schema[0].readUntil)
|
|
||||||
schema[0].readUntil.push(chars.arrayEnd);
|
|
||||||
}else{
|
|
||||||
this._m(schema[0]);//let's object portion handle it
|
|
||||||
var lastMostKey = getLastMostKey(schema[0]);
|
|
||||||
if(lastMostKey){
|
|
||||||
this.setReadUntil(lastMostKey, schema[0]);
|
|
||||||
if(lastMostKey.readUntil)
|
|
||||||
lastMostKey.readUntil.push(chars.arrayEnd);
|
|
||||||
}else{
|
|
||||||
//lastmostkey was set as it was under an array
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(typeof schema === "object"){
|
|
||||||
var keys = Object.keys(schema);
|
|
||||||
var len = keys.length;
|
|
||||||
|
|
||||||
for(var i=0; i< len; i++){
|
|
||||||
var key = keys[i];
|
|
||||||
var nextKey = keys[i+1];
|
|
||||||
|
|
||||||
this._m(schema[key]);
|
|
||||||
if(Array.isArray(schema[key])) continue;
|
|
||||||
else if(nextKey){
|
|
||||||
if(typeof schema[key] !== "string"){//not an object
|
|
||||||
var lastMostKey = getLastMostKey(schema[key]);
|
|
||||||
if(lastMostKey){
|
|
||||||
this.setReadUntil(lastMostKey,schema[nextKey]);
|
|
||||||
}else{
|
|
||||||
//lastmostkey was set as it was under an array
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
var itemSchema = {
|
|
||||||
type : schema[key]
|
|
||||||
}
|
|
||||||
this.setReadUntil(itemSchema,schema[nextKey]);
|
|
||||||
schema[key] = itemSchema ;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(typeof schema[key] === "object") continue;
|
|
||||||
schema[key] = {
|
|
||||||
type : schema[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(!this.dataHandlers[schema]){//handled
|
|
||||||
throw Error("You've forgot to add data handler for " + schema)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
schemaMarker.prototype.setReadUntil = function(current,next){
|
|
||||||
//status: R,S
|
|
||||||
if(this.dataHandlers[current.type].hasFixedInstances){
|
|
||||||
//if current char is set by user and need to be separated by boundary char
|
|
||||||
//then don't set readUntil, read current char
|
|
||||||
return ;
|
|
||||||
}else{
|
|
||||||
|
|
||||||
//return [chars.boundryChar, chars.missingPremitive, chars.nilPremitive];
|
|
||||||
if(Array.isArray(next)){
|
|
||||||
current.readUntil = [ chars.arrStart, chars.missingChar, chars.emptyChar, chars.nilChar];
|
|
||||||
}else if(typeof next === "object"){
|
|
||||||
current.readUntil = [ chars.objStart, chars.missingChar, chars.emptyChar, chars.nilChar];
|
|
||||||
}else{
|
|
||||||
if(this.dataHandlers[next] && this.dataHandlers[next].hasFixedInstances){//but need to be separated by boundary char
|
|
||||||
//status,boolean
|
|
||||||
current.readUntil = [chars.missingPremitive, chars.nilPremitive];
|
|
||||||
current.readUntil = current.readUntil.concat(this.dataHandlers[next].getCharCodes());
|
|
||||||
}else{
|
|
||||||
///status,age
|
|
||||||
current.readUntil = [chars.boundryChar, chars.emptyValue, chars.missingPremitive, chars.nilPremitive];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* obj can't be an array
|
|
||||||
* @param {*} obj
|
|
||||||
*/
|
|
||||||
function getLastMostKey(obj){
|
|
||||||
var lastProperty;
|
|
||||||
if(Array.isArray(obj)){
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
var keys = Object.keys(obj);
|
|
||||||
lastProperty = obj[keys[keys.length-1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof lastProperty === "object" && !(lastProperty.type && typeof lastProperty.type === "string")){
|
|
||||||
return getLastMostKey(lastProperty);
|
|
||||||
}else{
|
|
||||||
return lastProperty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
schemaMarker.prototype.markNextPossibleChars = function(schema){
|
|
||||||
this._m(schema);
|
|
||||||
if(!Array.isArray(schema)){
|
|
||||||
var lastMostKey = getLastMostKey(schema);
|
|
||||||
if(lastMostKey){
|
|
||||||
lastMostKey.readUntil = [chars.nilChar]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function schemaMarker(dataHandlers){
|
|
||||||
this.dataHandlers = dataHandlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = schemaMarker;
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* converts a ASCII number into equivalant ASCII char
|
|
||||||
* @param {number} a
|
|
||||||
* @returns ASCII char
|
|
||||||
*/
|
|
||||||
var char = function (a){
|
|
||||||
return String.fromCharCode(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* return key of an object
|
|
||||||
* @param {*} obj
|
|
||||||
* @param {number} i
|
|
||||||
*/
|
|
||||||
/* function getKey(obj,i){
|
|
||||||
return obj[Object.keys(obj)[i]];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* function indexOf(arr,searchedID) {
|
|
||||||
var arrayLen = arr.length;
|
|
||||||
var c = 0;
|
|
||||||
while (c < arrayLen) {
|
|
||||||
if (arr[c] === searchedID) return c;
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
} */
|
|
||||||
exports.char = char;
|
|
||||||
//exports.indexOf = indexOf;
|
|
||||||
Loading…
Reference in New Issue