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

tomlify-j0.4

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tomlify-j0.4 - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

13

dist/tomlify.min.js

@@ -1,12 +0,1 @@

(function(){function u(a,c,b){return p(a)?C(a,c,b):D(a,c,b)}function C(a,c,b){E(a);c="function"===typeof c?c:null;b=F(b);var d=[];x({path:[],table:{"":a},c:!1,b:!1,replace:c,level:0,a:b,f:d},"",a,function(a,b,c){if(p(c))""!==b&&(0<d.length&&d.push(""),b=a.b?"[["+y(a.path,!0)+"]]":"["+y(a.path,!0)+"]",d.push(r(b,a.level,a.a)));else if(t(c))if(k(b))v(c)||(b=B(a,b,c),k(b)&&d.push(r(b,a.level,a.a)));else return!0;else return k(b)&&(b=B(a,b,c),k(b)&&d.push(r(b,a.level,a.a))),!0});return d.join("\n")}function E(a){if(null==
a)throw Error("Undefined or null cannot be stringified.");if(I(a))throw Error("Converting circular structure to TOML.");}function F(a){return k(a)?a:"number"===typeof a&&0<=a&&isFinite(a)&&Math.floor(a)===a?G(" ",a):""}function r(a,c,b){c=G(b,c);return a.replace(/^(?!$)/mg,c)}function G(a,c){if(a.repeat)return a.repeat(c);for(var b="",d="";0<c;)d+=d||a,c&1&&(b+=d),c>>>=1;return b}function x(a,c,b,d){if(a.replace&&0===a.path.length){var f=z(a,c,b);k(f)&&a.f.push(f);if(!1!==f)return}if(!d(a,c,b)){var g=
a.table;a.table=b;if(t(b)){c=a.b;a.b=v(b);for(var e=0,n=b.length;e<n;e++)a.path.push(e),x(a,e,b[e],d),a.path.pop();a.b=c}else if(p(b)){c=a.b;a.b=!1;var l=[],m=[],h;for(h in b)Object.prototype.hasOwnProperty.call(b,h)&&(f=b[h],e=0<a.path.length&&(t(f)?v(f):p(f)),t(f)&&v(f)?m.push(h,f,e):p(f)?l.push(h,f,e):(a.path.push(h),x(a,h,f,d),a.path.pop()));if(a.replace){e=0;for(n=l.length;e<n;e+=3)a.path.push(l[e]),f=z(a,l[e],l[e+1]),!1!==f&&(k(f)&&a.f.push(r(f,a.level,a.a)),l[e+1]=null),a.path.pop();e=0;for(n=
m.length;e<n;e+=3){a.path.push(m[e]);f=z(a,m[e],m[e+1]);if(!1!==f)k(f)&&a.f.push(r(f,a.level,a.a)),m[e+1]=null;else for(b=0,h=m[e+1].length;b<h;b++)if(a.path.push(b),f=z(a,b,m[e+1][b]),a.path.pop(),!1!==f)if(null==f)m[e+1][b]=null;else{f=B(a,m[e],m[e+1]);k(f)&&a.f.push(r(f,a.level,a.a));m[e+1]=null;break}a.path.pop()}}h=l.concat(m);e=0;for(n=h.length;e<n;e+=3)null!=h[e+1]&&(a.path.push(h[e]),h[e+2]&&a.level++,x(a,h[e],h[e+1],d),h[e+2]&&a.level--,a.path.pop());a.b=c}a.table=g}}function z(a,c,b){if(a.replace){b=
a.replace.call({path:a.path.slice(0),table:a.table},c,b);if(k(b))return w(c)+" = "+b;if(null==b)return null;if(!1!==b)throw Error(l(a.path,"Replacer must return a string, false, null or undefined."));}return!1}function B(a,c,b){var d=w(c);if(!d)throw Error(l(a.path,"Key cannot be an empty string."));a=A(a,c,b);return k(a)?d+" = "+a:null}function w(a){return a?/^[a-zA-Z0-9\-_]+$/.test(a)?a:H(a):!1}function D(a,c,b){E(a);return A({path:[],table:{"":a},b:!1,replace:"function"===typeof c?c:null,level:0,
a:F(b)},"",a)}function A(a,c,b){if(a.replace){c=a.replace.call({path:a.path.slice(0),table:a.table},c,b);if(k(c))return c;if(null==c)return null;if(!1!==c)throw Error(l(a.path,"Replacer must return a string, false, null or undefined."));}switch(g(b)){case g.Boolean:return b?"true":"false";case g.String:return H(b);case g.Number:if(!isFinite(b))throw Error(l(a.path,"Number must be finite."));a=(Number.isInteger?Number.isInteger(b):Math.floor(b)===b)?b.toFixed(1):String(b);a=a.replace(/([eE])(\d)/,
"$1+$2");return/[.eE]/.test(a)?a:a+".0";case g.Array:a:{if(!(2>b.length)){var d=g(b[0]);c=1;for(var f=b.length;c<f;c++)if(null!=b[c]&&g(b[c])!==d){d=!0;break a}}d=!1}if(d)throw Error(l(a.path,"Array cannot contain values of different types."));d=a.table;a.table=b;c=[];f=a.c;v(b)&&(a.c=!0);for(var q=0,e=b.length;q<e;q++){a.path.push(q);var n=A(a,q,b[q]);k(n)&&c.push(n);a.path.pop()}a.c=f;a.table=d;return!a.c&&0<c.length&&a.a?"[\n"+r(c.join(",\n"),1,a.a)+"\n]":"["+c.join(", ")+"]";case g.Date:if(!isFinite(b.getTime()))throw Error(l(a.path,
"Invalid Date"));return b.toISOString();default:if(null==b)a=null;else{c=a.table;a.table=b;f=a.c;a.c=!0;q=[];for(d in b)if(Object.prototype.hasOwnProperty.call(b,d)&&null!=b[d]){if(!d)throw Error(l(a.path,"Key cannot be an empty string."));a.path.push(d);e=A(a,d,b[d]);k(e)&&q.push(w(d)+" = "+e);a.path.pop()}a.c=f;a.table=c;a="{"+q.join(", ")+"}"}return a}}function H(a){return"object"===typeof JSON&&JSON?JSON.stringify(a):'"'+String(a).replace(/[\x00-\x1F"\\]/g,function(a){switch(a){case '"':case "\\":return"\\"+
a;case "\t":return"\\t";case "\n":return"\\n";case "\r":return"\\r";case "\b":return"\\b";case "\f":return"\\f";default:return a=a.charCodeAt(0).toString(16),"\\u"+"0000".substr(a.length)+a}})+'"'}function I(a){function c(a,d){if(!t(a)&&!p(a))return!1;if(-1!==d.indexOf(a))return!0;d.push(a);for(var b in a)if(Object.prototype.hasOwnProperty.call(a,b)){var g=d.length;if(c(a[b],d))return!0;d.splice(g)}return!1}return c(a,[])}function v(a){if(1>a.length)return!1;for(var c=0,b=a.length;c<b;c++)if(p(a[c]))return!0;
return!1}function p(a){return null!==a&&"object"===typeof a&&!(t(a)||g(a)===g.Date)}function k(a){return"string"===typeof a}function g(a){return Object.prototype.toString.call(a)}function l(a,c){return(y(a)||"<root>")+": "+c}function y(a,c){if(0===a.length)return"";for(var b="",d=0,f=a.length;d<f;d++)if(k(a[d])&&a[d])b+=(b?".":"")+w(a[d]);else if("number"===typeof a[d])c||(b+=(b?".":"")+"["+a[d]+"]");else return!1;return b?b:!1}g.Boolean=g(!1);g.String=g("");g.Number=g(0);g.Array=g([]);g.Date=g(new Date(0));
var t=Array.isArray||function(a){return g(a)===g.Array};u.toToml=function(a,c,b){if(!p(a))throw Error("An object other than Array or Date is expected.");return C(a,c,b)};u.toKey=function(a,c){if(k(a)){var b=w(a);if(!b)throw Error("Key cannot be an empty string.");return b}if(t(a)){b=y(a,c);if(!1===b)throw Error("Key path must consist of non-empty string(s).");return b}throw Error("Invalid Arguments for tomlify.toKey({String | Array})");};u.toValue=D;null!=("undefined"!==typeof module&&null!==module?
module.exports:void 0)?module.exports=u:"function"===typeof define&&define.amd?define([],function(){return u}):this.tomlify=u}).call(this);
(function(){"use strict";var r=function(r,e){if(0===r.length)return"";for(var n="",i=0,u=r.length;i<u;i++)if(t(r[i])&&r[i])n+=(n?".":"")+m(r[i]);else{if(!a(r[i]))return!1;e||(n+=(n?".":"")+"["+r[i]+"]")}return n||!1},e=function(e,n){return(r(e)||"<root>")+": "+n},n=function(r){return Object.prototype.toString.call(r)};n.Boolean=n(!1),n.String=n(""),n.Number=n(0),n.Array=n([]),n.Date=n(new Date(0));var t=function(r){return"string"==typeof r},a=function(r){return"number"==typeof r},i=Array.isArray||function(r){return n(r)===n.Array},u=function(r){return n(r)===n.Date},l=function(r){return null!==r&&"object"==typeof r&&!(i(r)||u(r))},o=function(r){if(r.length<2)return!1;for(var e=n(r[0]),t=1,a=r.length;t<a;t++)if(null!=r[t]&&n(r[t])!==e)return!0;return!1},f=function(r){if(r.length<1)return!1;for(var e=0,n=r.length;e<n;e++)if(l(r[e]))return!0;return!1},p=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},c=function(r){var e=function(r,n){if(!i(r)&&!l(r))return!1;if(-1!==n.indexOf(r))return!0;n.push(r);for(var t in r)if(p(r,t)){var a=n.length;if(e(r[t],n))return!0;n.splice(a)}return!1};return e(r,[])},s=function(r,e,n){return n?"true":"false"},h=function(r,e,n){return"object"==typeof JSON&&JSON?JSON.stringify(n):'"'+String(n).replace(/[\x00-\x1F"\\]/g,function(r){switch(r){case'"':case"\\":return"\\"+r;case"\t":return"\\t";case"\n":return"\\n";case"\r":return"\\r";case"\b":return"\\b";case"\f":return"\\f";default:var e=r.charCodeAt(0).toString(16);return"\\u"+"0000".substr(e.length)+e}})+'"'},v=function(r,n,t){if(!isFinite(t))throw new Error(e(r.path,"Number must be finite."));var a;return a=(Number.isInteger?Number.isInteger(t):Math.floor(t)===t)?t.toFixed(1):String(t),a=a.replace(/([eE])(\d)/,"$1+$2"),/[.eE]/.test(a)?a:a+".0"},b=function(r,n,a){if(o(a))throw new Error(e(r.path,"Array cannot contain values of different types."));var i=r.table;r.table=a;var u=[],l=r.inPair;f(a)&&(r.inPair=!0);for(var p=0,c=a.length;p<c;p++){r.path.push(p);var s=w(r,p,a[p]);t(s)&&u.push(s),r.path.pop()}return r.inPair=l,r.table=i,!r.inPair&&u.length>0&&r.space?"[\n"+O(u.join(",\n"),1,r.space)+"\n]":"["+u.join(", ")+"]"},g=function(r,n,t){if(!isFinite(t.getTime()))throw new Error(e(r.path,"Invalid Date"));return t.toISOString()},y=function(r,n,a){var i=r.table;r.table=a;var u=r.inPair;r.inPair=!0;var l=[];for(var o in a)if(p(a,o)&&null!=a[o]){if(!o)throw new Error(e(r.path,"Key cannot be an empty string."));r.path.push(o);var f=w(r,o,a[o]);t(f)&&l.push(m(o)+" = "+f),r.path.pop()}return r.inPair=u,r.table=i,"{"+l.join(", ")+"}"},w=function(r,a,i){if(r.replace){var u=r.replace.call(E(r),a,i);if(t(u))return u;if(null==u)return null;if(!1!==u)throw new Error(e(r.path,"Replacer must return a string, false, null or undefined."))}switch(n(i)){case n.Boolean:return s(0,0,i);case n.String:return h(0,0,i);case n.Number:return v(r,0,i);case n.Array:return b(r,0,i);case n.Date:return g(r,0,i);default:return null==i?null:y(r,0,i)}},d=function(r,e,n){return x(r),w({path:[],table:{"":r},inTableArray:!1,replace:N(e),level:0,space:P(n)},"",r)},m=function(r){return!!r&&(/^[a-zA-Z0-9\-_]+$/.test(r)?r:h(0,0,r))},A=function(r,n,a){var i=m(n);if(!i)throw new Error(e(r.path,"Key cannot be an empty string."));var u=w(r,n,a);return t(u)?i+" = "+u:null},E=function(r){return{path:r.path.slice(0),table:r.table}},S=function(r,n,a){if(r.replace){var i=r.replace.call(E(r),n,a);if(t(i))return m(n)+" = "+i;if(null==i)return null;if(!1!==i)throw new Error(e(r.path,"Replacer must return a string, false, null or undefined."))}return!1},T=function(r,e,n,a){var u;if(!(r.replace&&0===r.path.length&&(u=S(r,e,n),t(u)&&r.lines.push(u),!1!==u)||a(r,e,n))){var o=r.table;if(r.table=n,i(n)){h=r.inTableArray;r.inTableArray=f(n);for(var c=0,s=n.length;c<s;c++)r.path.push(c),T(r,c,n[c],a),r.path.pop();r.inTableArray=h}else if(l(n)){var h=r.inTableArray;r.inTableArray=!1;var v=[],b=[];for(var g in n)if(p(n,g)){var y=n[g],w=r.path.length>0&&(i(y)?f(y):l(y));i(y)&&f(y)?b.push(g,y,w):l(y)?v.push(g,y,w):(r.path.push(g),T(r,g,y,a),r.path.pop())}if(r.replace){for(var c=0,s=v.length;c<s;c+=3)r.path.push(v[c]),!1!==(u=S(r,v[c],v[c+1]))&&(t(u)&&r.lines.push(O(u,r.level,r.space)),v[c+1]=null),r.path.pop();for(var c=0,s=b.length;c<s;c+=3)if(r.path.push(b[c]),!1===(u=S(r,b[c],b[c+1]))){for(var d=0,g=b[c+1].length;d<g;d++){r.path.push(d);var m=b[c+1][d];if(u=S(r,d,m),r.path.pop(),!1!==u){if(null==u){b[c+1][d]=null;continue}u=A(r,b[c],b[c+1]),t(u)&&r.lines.push(O(u,r.level,r.space)),b[c+1]=null;break}}r.path.pop()}else t(u)&&r.lines.push(O(u,r.level,r.space)),b[c+1]=null,r.path.pop()}for(var E=v.concat(b),c=0,s=E.length;c<s;c+=3)null!=E[c+1]&&(r.path.push(E[c]),E[c+2]&&r.level++,T(r,E[c],E[c+1],a),E[c+2]&&r.level--,r.path.pop());r.inTableArray=h}r.table=o}},j=function(r,e){if(r.repeat)return r.repeat(e);for(var n="",t="";e>0;)t+=t||r,1&e&&(n+=t),e>>>=1;return n},O=function(r,e,n){var t=j(n,e);return r.replace(/^(?!$)/gm,t)},P=function(r){return t(r)?r:a(r)&&r>=0&&isFinite(r)&&Math.floor(r)===r?j(" ",r):""},N=function(r){return"function"==typeof r?r:null},x=function(r){if(null==r)throw new Error("Undefined or null cannot be stringified.");if(c(r))throw new Error("Converting circular structure to TOML.")},D=function(e,n,a){x(e),n=N(n),a=P(a);var u=[];return T({path:[],table:{"":e},inPair:!1,inTableArray:!1,replace:n,level:0,space:a,lines:u},"",e,function(e,n,a){var o=null;if(l(a))""!==n&&(u.length>0&&u.push(""),o=e.inTableArray?"[["+r(e.path,!0)+"]]":"["+r(e.path,!0)+"]",u.push(O(o,e.level,e.space)));else{if(!i(a))return t(n)&&(o=A(e,n,a),t(o)&&u.push(O(o,e.level,e.space))),!0;if(!t(n))return!0;f(a)||(o=A(e,n,a),t(o)&&u.push(O(o,e.level,e.space)))}}),u.join("\n")},K=function(r,e,n){return l(r)?D(r,e,n):d(r,e,n)};K.toToml=function(r,e,n){if(!l(r))throw new Error("An object other than Array or Date is expected.");return D(r,e,n)},K.toKey=function(e,n){if(t(e)){if(!(a=m(e)))throw new Error("Key cannot be an empty string.");return a}if(i(e)){var a=r(e,n);if(!1===a)throw new Error("Key path must consist of non-empty string(s).");return a}throw new Error("Invalid Arguments for tomlify.toKey({String | Array})")},K.toValue=d,null!=("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=K:"function"==typeof define&&define.amd?define([],function(){return K}):this.tomlify=K}).call(this);

13

package.json
{
"name": "tomlify-j0.4",
"version": "2.2.0",
"version": "2.2.1",
"description": "A Object->TOML encoder/converter only for TOML v0.4.0",

@@ -8,4 +8,14 @@ "main": "tomlify.js",

"scripts": {
"dist": "uglifyjs --verbose --compress --mangle -o dist/tomlify.min.js tomlify.js",
"prepare": "npm run dist",
"test": "mocha --bail --reporter min test/*.js"
},
"files": [
"LICENSE",
"README.md",
"CHANGELOG.md",
"dist/tomlify.min.js",
"tomlify.d.ts",
"tomlify.js"
],
"keywords": [

@@ -33,4 +43,5 @@ "toml",

"should": "~11.2.1",
"uglify-js": "~3.0.25",
"toml-j0.4": "~1.1.0"
}
}
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