Comparing version 1.8.0 to 1.8.1
/*! @preserve | ||
* Hjson v1.7.6 | ||
* Hjson v1.8.1 | ||
* http://hjson.org | ||
* | ||
* Copyright 2014, 2015 Christian Zangl, MIT license | ||
* Copyright 2014-2016 Christian Zangl, MIT license | ||
* Details and documentation: | ||
@@ -306,3 +306,4 @@ * https://github.com/laktak/hjson-js | ||
else if (ch <= ' ') { | ||
if (space < 0) space = name.length; | ||
if (!ch) error("Found EOF while looking for a key name (check your syntax)"); | ||
else if (space < 0) space = name.length; | ||
} | ||
@@ -309,0 +310,0 @@ else if (ch === '{' || ch === '}' || ch === '[' || ch === ']' || ch === ',') { |
/*! @preserve | ||
* Hjson v1.7.6 | ||
* Hjson v1.8.1 | ||
* http://hjson.org | ||
* | ||
* Copyright 2014, 2015 Christian Zangl, MIT license | ||
* Copyright 2014-2016 Christian Zangl, MIT license | ||
* Details and documentation: | ||
@@ -12,2 +12,2 @@ * https://github.com/laktak/hjson-js | ||
*/ | ||
var Hjson=function(){"use strict";var r="\n",e=!1,n=function(r,e){function n(){return u=r.charAt(a),a++,u}var t,u,f="",i=0,o=!0,a=0;for(n(),"-"===u&&(f="-",n());u>="0"&&"9">=u;)o&&("0"==u?i++:o=!1),f+=u,n();if(o&&i--,"."===u)for(f+=".";n()&&u>="0"&&"9">=u;)f+=u;if("e"===u||"E"===u)for(f+=u,n(),("-"===u||"+"===u)&&(f+=u,n());u>="0"&&"9">=u;)f+=u,n();for(;u&&" ">=u;)n();return e&&(","===u||"}"===u||"]"===u||"#"===u||"/"===u&&("/"===r[a]||"*"===r[a]))&&(u=0),t=+f,u||i||!isFinite(t)?void 0:t},t=function(){var r,e,t,u,f={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},i=function(n){var t,u=0,f=1;for(t=e-1;t>0&&"\n"!==r[t];t--,u++);for(;t>0;t--)"\n"===r[t]&&f++;throw new Error(n+" at line "+f+","+u+" >>>"+r.substr(e-u,20)+" ...")},o=function(n){return n&&n!==t&&i("Expected '"+n+"' instead of '"+t+"'"),t=r.charAt(e),e++,t},a=function(n){return r.charAt(e+n)},s=function(){var r,e,n,u="";if('"'===t)for(;o();){if('"'===t)return o(),u;if("\\"===t)if(o(),"u"===t){for(n=0,e=0;4>e&&(r=parseInt(o(),16),isFinite(r));e++)n=16*n+r;u+=String.fromCharCode(n)}else{if("string"!=typeof f[t])break;u+=f[t]}else u+=t}i("Bad string")},c=function(){for(var r="",e=0,n=0;;){var u=a(-n-5);if(!u||"\n"===u)break;n++}for(var f=function(){for(var r=n;t&&" ">=t&&"\n"!==t&&r-->0;)o()};t&&" ">=t&&"\n"!==t;)o();for("\n"===t&&(o(),f());;){if(t){if("'"===t){if(e++,o(),3===e)return"\n"===r.slice(-1)&&(r=r.slice(0,-1)),r;continue}for(;e>0;)r+="'",e--}else i("Bad multiline string");"\n"===t?(r+="\n",o(),f()):("\r"!==t&&(r+=t),o())}},l=function(){if('"'===t)return s();for(var r="",n=e,u=-1;;){if(":"===t)return r?u>=0&&u!==r.length&&(e=n+u,i("Found whitespace in your key name (use quotes to include)")):i("Found ':' but no key name (for an empty key name use quotes)"),r;" ">=t?0>u&&(u=r.length):"{"===t||"}"===t||"["===t||"]"===t||","===t?i("Found '"+t+"' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)"):r+=t,o()}},p=function(){for(;t;){for(;t&&" ">=t;)o();if("#"===t||"/"===t&&"/"===a(0))for(;t&&"\n"!==t;)o();else{if("/"!==t||"*"!==a(0))break;for(o(),o();t&&("*"!==t||"/"!==a(0));)o();t&&(o(),o())}}},h=function(){for(var r=t;o();){if(3===r.length&&"'''"===r)return c();var e="\r"===t||"\n"===t;if(e||","===t||"}"===t||"]"===t||"#"===t||"/"===t&&("/"===a(0)||"*"===a(0))){var u=r[0];switch(u){case"f":if("false"===r.trim())return!1;break;case"n":if("null"===r.trim())return null;break;case"t":if("true"===r.trim())return!0;break;default:if("-"===u||u>="0"&&"9">=u){var f=n(r);if(void 0!==f)return f}}if(e)return r.trim()}r+=t}i("End of input while parsing a value")},d=function(n){var t;for(n--,t=e-2;t>n&&r[t]<=" "&&"\n"!==r[t];t--);"\n"===r[t]&&t--,"\r"===r[t]&&t--;var u=r.substr(n,t-n+1);for(t=0;t<u.length;t++)if(u[t]>" ")return u;return""},b=function(){var r,n,f=[];if(u&&(Object.defineProperty&&Object.defineProperty(f,"__WSC__",{enumerable:!1,writable:!0}),f.__WSC__=r=[]),o(),n=e,p(),r&&r.push(d(n)),"]"===t)return o(),f;for(;t;){if(f.push(g()),n=e,p(),","===t&&(o(),n=e,p()),r&&r.push(d(n)),"]"===t)return o(),f;p()}i("End of input while parsing an array (did you forget a closing ']'?)")},v=function(r){function n(r){a.c[r]=d(s),r&&a.o.push(r)}var f,a,s,c={};if(u&&(Object.defineProperty&&Object.defineProperty(c,"__WSC__",{enumerable:!1,writable:!0}),c.__WSC__=a={c:{},o:[]},r&&(a.noRootBraces=!0)),r?s=1:(o(),s=e),p(),a&&n(""),"}"===t&&!r)return o(),c;for(;t;){if(f=l(),p(),o(":"),c[f]=g(),s=e,p(),","===t&&(o(),s=e,p()),a&&n(f),"}"===t&&!r)return o(),c;p()}return r?c:void i("End of input while parsing an object (did you forget a closing '}'?)")},g=function(){switch(p(),t){case"{":return v();case"[":return b();case'"':return s();default:return h()}},y=function(){switch(p(),t){case"{":return v();case"[":return b()}for(var e=0;e<r.length;e++)if("\n"===r[e])return v(!0);return g()};return function(n,f){var o;return u=f&&f.keepWsc,r=n,e=0,t=" ",o=y(),p(),t&&i("Syntax error, found trailing characters"),o}}(),u=function(){function t(r){return" ">=r}function u(r){return r.replace(d,function(r){var e=y[r];return"string"==typeof e?e:"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)})}function f(r,e,f,o){if(!r)return'""';b.lastIndex=0,g.lastIndex=0;var a=p||f||b.test(r),s=r[0],c=r[r.length-1];return a||t(s)||'"'===s||"#"===s||"/"===s&&("*"===r[1]||"/"===r[1])||"{"===s||"["===s||t(c)||void 0!==n(r,!0)||g.test(r)?(d.lastIndex=0,v.lastIndex=0,d.test(r)?v.test(r)||o?'"'+u(r)+'"':i(r,e):'"'+r+'"'):r}function i(r,e){var n,t=r.replace(/\r/g,"").split("\n");if(e+=j,1===t.length)return"'''"+t[0]+"'''";var u=s+e+"'''";for(n=0;n<t.length;n++)u+=s,t[n]&&(u+=e+t[n]);return u+s+e+"'''"}function o(r){return r?x.test(r)?(d.lastIndex=0,'"'+(d.test(r)?u(r):r)+'"'):r:'""'}function a(r,e,n,t){function u(r){return r&&"\n"===r["\r"===r[0]?1:0]}function i(r){return r&&!u(r)}function p(r){if(!r)return"";for(var e=0;e<r.length;e++){var n=r[e];if("\n"===n||"#"===n||"/"===n&&("/"===r[e+1]||"*"===r[e+1]))break;if(n>" ")return" # "+r}return r}switch(typeof r){case"string":return f(r,m,e,t);case"number":return isFinite(r)?String(r):"null";case"boolean":return String(r);case"object":if(!r)return"null";var d,b;c&&(d=r.__WSC__);var v="[object Array]"===Object.prototype.toString.apply(r),g=v||!t||(d?!d.noRootBraces:h),y=m;g&&(m+=j);var x,_,w,k,O=s+y,S=s+m,E=n||l?"":O,W=[];if(v){for(x=0,_=r.length;_>x;x++)d&&W.push(p(d[x])+S),W.push(a(r[x],d?i(d[x+1]):!1,!0)||"null");d&&W.push(p(d[x])+O),k=d?E+"["+W.join("")+"]":0===W.length?"[]":E+"["+S+W.join(S)+O+"]"}else{if(d){b=p(d.c[""]);var C=d.o.slice();for(w in r)Object.prototype.hasOwnProperty.call(r,w)&&C.indexOf(w)<0&&C.push(w);for(x=0,_=C.length;_>x;x++)w=C[x],(g||x>0||b)&&W.push(b+S),b=p(d.c[w]),k=a(r[w],i(b)),k&&W.push(o(w)+(u(k)?":":": ")+k);(g||b)&&W.push(b+O)}else for(w in r)Object.prototype.hasOwnProperty.call(r,w)&&(k=a(r[w]),k&&W.push(o(w)+(u(k)?":":": ")+k));k=0===W.length?"{}":g?d?E+"{"+W.join("")+"}":E+"{"+S+W.join(S)+O+"}":W.join(d?"":S)}return m=y,k}}var s,c,l,p,h,d=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b=/[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,v=/'''|[\x00-\x09\x0b\x0c\x0e-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g=/^(true|false|null)\s*((,|\]|\}|#|\/\/|\/\*).*)?$/,y={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},x=/[,\{\[\}\]\s]/,m="",j=" ";return function(n,t){var u,f;if(s=r,j=" ",c=!1,l=e,h=!0,p=!1,t&&"object"==typeof t&&(("\n"===t.eol||"\r\n"===t.eol)&&(s=t.eol),f=t.space,c=t.keepWsc,l=t.bracesSameLine||e,h=t.emitRootBraces,p="always"===t.quotes),"number"==typeof f)for(j="",u=0;f>u;u++)j+=" ";else"string"==typeof f&&(j=f);return a(n,null,!0,!0)}}();return{parse:t,stringify:u,endOfLine:function(){return r},setEndOfLine:function(e){("\n"===e||"\r\n"===e)&&(r=e)},bracesSameLine:function(){return e},setBracesSameLine:function(r){e=r},rt:{parse:function(r,e){return(e=e||{}).keepWsc=!0,t(r,e)},stringify:function(r,e){return(e=e||{}).keepWsc=!0,u(r,e)}}}}();if("object"==typeof module){if("function"==typeof require){var os=require("os");Hjson.setEndOfLine(os.EOL)}module.exports=Hjson} | ||
var Hjson=function(){"use strict";var r="\n",e=!1,n=function(r,e){function n(){return u=r.charAt(a),a++,u}var t,u,f="",i=0,o=!0,a=0;for(n(),"-"===u&&(f="-",n());u>="0"&&"9">=u;)o&&("0"==u?i++:o=!1),f+=u,n();if(o&&i--,"."===u)for(f+=".";n()&&u>="0"&&"9">=u;)f+=u;if("e"===u||"E"===u)for(f+=u,n(),("-"===u||"+"===u)&&(f+=u,n());u>="0"&&"9">=u;)f+=u,n();for(;u&&" ">=u;)n();return e&&(","===u||"}"===u||"]"===u||"#"===u||"/"===u&&("/"===r[a]||"*"===r[a]))&&(u=0),t=+f,u||i||!isFinite(t)?void 0:t},t=function(){var r,e,t,u,f={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},i=function(n){var t,u=0,f=1;for(t=e-1;t>0&&"\n"!==r[t];t--,u++);for(;t>0;t--)"\n"===r[t]&&f++;throw new Error(n+" at line "+f+","+u+" >>>"+r.substr(e-u,20)+" ...")},o=function(n){return n&&n!==t&&i("Expected '"+n+"' instead of '"+t+"'"),t=r.charAt(e),e++,t},a=function(n){return r.charAt(e+n)},s=function(){var r,e,n,u="";if('"'===t)for(;o();){if('"'===t)return o(),u;if("\\"===t)if(o(),"u"===t){for(n=0,e=0;4>e&&(r=parseInt(o(),16),isFinite(r));e++)n=16*n+r;u+=String.fromCharCode(n)}else{if("string"!=typeof f[t])break;u+=f[t]}else u+=t}i("Bad string")},c=function(){for(var r="",e=0,n=0;;){var u=a(-n-5);if(!u||"\n"===u)break;n++}for(var f=function(){for(var r=n;t&&" ">=t&&"\n"!==t&&r-->0;)o()};t&&" ">=t&&"\n"!==t;)o();for("\n"===t&&(o(),f());;){if(t){if("'"===t){if(e++,o(),3===e)return"\n"===r.slice(-1)&&(r=r.slice(0,-1)),r;continue}for(;e>0;)r+="'",e--}else i("Bad multiline string");"\n"===t?(r+="\n",o(),f()):("\r"!==t&&(r+=t),o())}},l=function(){if('"'===t)return s();for(var r="",n=e,u=-1;;){if(":"===t)return r?u>=0&&u!==r.length&&(e=n+u,i("Found whitespace in your key name (use quotes to include)")):i("Found ':' but no key name (for an empty key name use quotes)"),r;" ">=t?t?0>u&&(u=r.length):i("Found EOF while looking for a key name (check your syntax)"):"{"===t||"}"===t||"["===t||"]"===t||","===t?i("Found '"+t+"' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)"):r+=t,o()}},p=function(){for(;t;){for(;t&&" ">=t;)o();if("#"===t||"/"===t&&"/"===a(0))for(;t&&"\n"!==t;)o();else{if("/"!==t||"*"!==a(0))break;for(o(),o();t&&("*"!==t||"/"!==a(0));)o();t&&(o(),o())}}},h=function(){for(var r=t;o();){if(3===r.length&&"'''"===r)return c();var e="\r"===t||"\n"===t;if(e||","===t||"}"===t||"]"===t||"#"===t||"/"===t&&("/"===a(0)||"*"===a(0))){var u=r[0];switch(u){case"f":if("false"===r.trim())return!1;break;case"n":if("null"===r.trim())return null;break;case"t":if("true"===r.trim())return!0;break;default:if("-"===u||u>="0"&&"9">=u){var f=n(r);if(void 0!==f)return f}}if(e)return r.trim()}r+=t}i("End of input while parsing a value")},d=function(n){var t;for(n--,t=e-2;t>n&&r[t]<=" "&&"\n"!==r[t];t--);"\n"===r[t]&&t--,"\r"===r[t]&&t--;var u=r.substr(n,t-n+1);for(t=0;t<u.length;t++)if(u[t]>" ")return u;return""},b=function(){var r,n,f=[];if(u&&(Object.defineProperty&&Object.defineProperty(f,"__WSC__",{enumerable:!1,writable:!0}),f.__WSC__=r=[]),o(),n=e,p(),r&&r.push(d(n)),"]"===t)return o(),f;for(;t;){if(f.push(v()),n=e,p(),","===t&&(o(),n=e,p()),r&&r.push(d(n)),"]"===t)return o(),f;p()}i("End of input while parsing an array (did you forget a closing ']'?)")},g=function(r){function n(r){a.c[r]=d(s),r&&a.o.push(r)}var f,a,s,c={};if(u&&(Object.defineProperty&&Object.defineProperty(c,"__WSC__",{enumerable:!1,writable:!0}),c.__WSC__=a={c:{},o:[]},r&&(a.noRootBraces=!0)),r?s=1:(o(),s=e),p(),a&&n(""),"}"===t&&!r)return o(),c;for(;t;){if(f=l(),p(),o(":"),c[f]=v(),s=e,p(),","===t&&(o(),s=e,p()),a&&n(f),"}"===t&&!r)return o(),c;p()}return r?c:void i("End of input while parsing an object (did you forget a closing '}'?)")},v=function(){switch(p(),t){case"{":return g();case"[":return b();case'"':return s();default:return h()}},y=function(){switch(p(),t){case"{":return g();case"[":return b()}for(var e=0;e<r.length;e++)if("\n"===r[e])return g(!0);return v()};return function(n,f){var o;return u=f&&f.keepWsc,r=n,e=0,t=" ",o=y(),p(),t&&i("Syntax error, found trailing characters"),o}}(),u=function(){function t(r){return" ">=r}function u(r){return r.replace(d,function(r){var e=y[r];return"string"==typeof e?e:"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)})}function f(r,e,f,o){if(!r)return'""';b.lastIndex=0,v.lastIndex=0;var a=p||f||b.test(r),s=r[0],c=r[r.length-1];return a||t(s)||'"'===s||"#"===s||"/"===s&&("*"===r[1]||"/"===r[1])||"{"===s||"["===s||t(c)||void 0!==n(r,!0)||v.test(r)?(d.lastIndex=0,g.lastIndex=0,d.test(r)?g.test(r)||o?'"'+u(r)+'"':i(r,e):'"'+r+'"'):r}function i(r,e){var n,t=r.replace(/\r/g,"").split("\n");if(e+=j,1===t.length)return"'''"+t[0]+"'''";var u=s+e+"'''";for(n=0;n<t.length;n++)u+=s,t[n]&&(u+=e+t[n]);return u+s+e+"'''"}function o(r){return r?x.test(r)?(d.lastIndex=0,'"'+(d.test(r)?u(r):r)+'"'):r:'""'}function a(r,e,n,t){function u(r){return r&&"\n"===r["\r"===r[0]?1:0]}function i(r){return r&&!u(r)}function p(r){if(!r)return"";for(var e=0;e<r.length;e++){var n=r[e];if("\n"===n||"#"===n||"/"===n&&("/"===r[e+1]||"*"===r[e+1]))break;if(n>" ")return" # "+r}return r}switch(typeof r){case"string":return f(r,m,e,t);case"number":return isFinite(r)?String(r):"null";case"boolean":return String(r);case"object":if(!r)return"null";var d,b;c&&(d=r.__WSC__);var g="[object Array]"===Object.prototype.toString.apply(r),v=g||!t||(d?!d.noRootBraces:h),y=m;v&&(m+=j);var x,k,_,w,O=s+y,S=s+m,E=n||l?"":O,W=[];if(g){for(x=0,k=r.length;k>x;x++)d&&W.push(p(d[x])+S),W.push(a(r[x],d?i(d[x+1]):!1,!0)||"null");d&&W.push(p(d[x])+O),w=d?E+"["+W.join("")+"]":0===W.length?"[]":E+"["+S+W.join(S)+O+"]"}else{if(d){b=p(d.c[""]);var C=d.o.slice();for(_ in r)Object.prototype.hasOwnProperty.call(r,_)&&C.indexOf(_)<0&&C.push(_);for(x=0,k=C.length;k>x;x++)_=C[x],(v||x>0||b)&&W.push(b+S),b=p(d.c[_]),w=a(r[_],i(b)),w&&W.push(o(_)+(u(w)?":":": ")+w);(v||b)&&W.push(b+O)}else for(_ in r)Object.prototype.hasOwnProperty.call(r,_)&&(w=a(r[_]),w&&W.push(o(_)+(u(w)?":":": ")+w));w=0===W.length?"{}":v?d?E+"{"+W.join("")+"}":E+"{"+S+W.join(S)+O+"}":W.join(d?"":S)}return m=y,w}}var s,c,l,p,h,d=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b=/[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g=/'''|[\x00-\x09\x0b\x0c\x0e-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,v=/^(true|false|null)\s*((,|\]|\}|#|\/\/|\/\*).*)?$/,y={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},x=/[,\{\[\}\]\s]/,m="",j=" ";return function(n,t){var u,f;if(s=r,j=" ",c=!1,l=e,h=!0,p=!1,t&&"object"==typeof t&&(("\n"===t.eol||"\r\n"===t.eol)&&(s=t.eol),f=t.space,c=t.keepWsc,l=t.bracesSameLine||e,h=t.emitRootBraces,p="always"===t.quotes),"number"==typeof f)for(j="",u=0;f>u;u++)j+=" ";else"string"==typeof f&&(j=f);return a(n,null,!0,!0)}}();return{parse:t,stringify:u,endOfLine:function(){return r},setEndOfLine:function(e){("\n"===e||"\r\n"===e)&&(r=e)},bracesSameLine:function(){return e},setBracesSameLine:function(r){e=r},rt:{parse:function(r,e){return(e=e||{}).keepWsc=!0,t(r,e)},stringify:function(r,e){return(e=e||{}).keepWsc=!0,u(r,e)}}}}();if("object"==typeof module){if("function"==typeof require){var os=require("os");Hjson.setEndOfLine(os.EOL)}module.exports=Hjson} |
@@ -6,3 +6,3 @@ { | ||
"author": "Christian Zangl", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "json", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61189
77
1115