Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hjson

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hjson - npm Package Compare versions

Comparing version 1.7.4 to 1.7.5

14

lib/hjson.js
/*! @preserve
* Hjson v1.7.4
* Hjson v1.7.5
* http://hjson.org

@@ -298,12 +298,16 @@ *

var name = "";
var name = "", start = at, space = -1;
while (true) {
if (ch === ':') {
if (!name) error("Found ':' but no key name (for an empty key name use quotes)");
else if (space >=0 && space !== name.length) { at = start + space; error("Found whitespace in your key name (use quotes to include)"); }
return name;
}
else if (ch <= ' ' || ch === '{' || ch === '}' || ch === '[' || ch === ']' || ch === ',')
else if (ch <= ' ') {
if (space < 0) space = name.length;
}
else if (ch === '{' || ch === '}' || ch === '[' || ch === ']' || ch === ',') {
error("Found '" + ch + "' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)");
name += ch;
}
else name += ch;
next();

@@ -310,0 +314,0 @@ }

/*! @preserve
* Hjson v1.7.4
* Hjson v1.7.5
* http://hjson.org

@@ -12,2 +12,2 @@ *

*/
var Hjson=function(){"use strict";var r="\n",e=!1,n=function(r,e){function n(){return f=r.charAt(a),a++,f}var t,f,u="",i=0,o=!0,a=0;for(n(),"-"===f&&(u="-",n());f>="0"&&"9">=f;)o&&("0"==f?i++:o=!1),u+=f,n();if(o&&i--,"."===f)for(u+=".";n()&&f>="0"&&"9">=f;)u+=f;if("e"===f||"E"===f)for(u+=f,n(),("-"===f||"+"===f)&&(u+=f,n());f>="0"&&"9">=f;)u+=f,n();for(;f&&" ">=f;)n();return e&&(","===f||"}"===f||"]"===f||"#"===f||"/"===f&&("/"===r[a]||"*"===r[a]))&&(f=0),t=+u,f||i||!isFinite(t)?void 0:t},t=function(){var r,e,t,f,u={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},i=function(n){var t,f=0,u=1;for(t=e-1;t>0&&"\n"!==r[t];t--,f++);for(;t>0;t--)"\n"===r[t]&&u++;throw new Error(n+" at line "+u+","+f+" >>>"+r.substr(e-f,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,f="";if('"'===t)for(;o();){if('"'===t)return o(),f;if("\\"===t)if(o(),"u"===t){for(n=0,e=0;4>e&&(r=parseInt(o(),16),isFinite(r));e++)n=16*n+r;f+=String.fromCharCode(n)}else{if("string"!=typeof u[t])break;f+=u[t]}else f+=t}i("Bad string")},c=function(){for(var r="",e=0,n=0;;){var f=a(-n-5);if(!f||"\n"===f)break;n++}for(var u=function(){for(var r=n;t&&" ">=t&&"\n"!==t&&r-->0;)o()};t&&" ">=t&&"\n"!==t;)o();for("\n"===t&&(o(),u());;){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(),u()):("\r"!==t&&(r+=t),o())}},l=function(){if('"'===t)return s();for(var r="";;){if(":"===t)return r||i("Found ':' but no key name (for an empty key name use quotes)"),r;(" ">=t||"{"===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 f=r[0];switch(f){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("-"===f||f>="0"&&"9">=f){var u=n(r);if(void 0!==u)return u}}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 f=r.substr(n,t-n+1);for(t=0;t<f.length;t++)if(f[t]>" ")return f;return""},b=function(){var r,n,u=[];if(f&&(Object.defineProperty&&Object.defineProperty(u,"__WSC__",{enumerable:!1,writable:!0}),u.__WSC__=r=[]),o(),n=e,p(),r&&r.push(d(n)),"]"===t)return o(),u;for(;t;){if(u.push(g()),n=e,p(),","===t&&(o(),n=e,p()),r&&r.push(d(n)),"]"===t)return o(),u;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 u,a,s,c={};if(f&&(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(u=l(),p(),o(":"),c[u]=g(),s=e,p(),","===t&&(o(),s=e,p()),a&&n(u),"}"===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,u){var o;return f=u&&u.keepWsc,r=n,e=0,t=" ",o=y(),p(),t&&i("Syntax error, found trailing characters"),o}}(),f=function(){function t(r){return" ">=r}function f(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 u(r,e,u,o){if(!r)return'""';b.lastIndex=0,g.lastIndex=0;var a=p||u||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?'"'+f(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 f=s+e+"'''";for(n=0;n<t.length;n++)f+=s,t[n]&&(f+=e+t[n]);return f+s+e+"'''"}function o(r){return r?x.test(r)?(d.lastIndex=0,'"'+(d.test(r)?f(r):r)+'"'):r:'""'}function a(r,e,n,t){function f(r){return r&&"\n"===r["\r"===r[0]?1:0]}function i(r){return r&&!f(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 u(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)+(f(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)+(f(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 f,u;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),u=t.space,c=t.keepWsc,l=t.bracesSameLine||e,h=t.emitRootBraces,p="always"===t.quotes),"number"==typeof u)for(j="",f=0;u>f;f++)j+=" ";else"string"==typeof u&&(j=u);return a(n,null,!0,!0)}}();return{parse:t,stringify:f,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,f(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?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}

@@ -6,3 +6,3 @@ {

"author": "Christian Zangl",
"version": "1.7.4",
"version": "1.7.5",
"keywords": [

@@ -9,0 +9,0 @@ "json",

@@ -5,3 +5,2 @@ # hjson-js

[![NPM version](https://img.shields.io/npm/v/hjson.svg?style=flat-square)](http://www.npmjs.com/package/hjson)
[![License](https://img.shields.io/github/license/laktak/hjson-js.svg?style=flat-square)](https://github.com/laktak/hjson-js/blob/master/LICENSE)

@@ -8,0 +7,0 @@ [Hjson](http://hjson.org), the Human JSON. A configuration file format that caters to humans and helps reduce the errors they make.

@@ -6,3 +6,5 @@ {

"-test": "test",
".key": "test"
".key": "test",
"trailing": "test",
"trailing2": "test"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc