@typed/common
Advanced tools
Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "@typed/common", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Assortment of shared functions & types for Typed libraries", | ||
@@ -31,4 +31,4 @@ "main": "./cjs/index.js", | ||
"sideEffects": false, | ||
"gitHead": "e36eeac429e22e43156a9723ef9d4e4b0648eeac", | ||
"gitHead": "a381603384ec39ed3958beea7167949e7b47eb58", | ||
"unpkg": "./umd/index.js" | ||
} |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).Typed=e.Typed||{},e.Typed.Common={}))}(this,(function(e){"use strict";function t(e,t){const n=Object.keys(t).sort().map(function(e){return t=>{const n=e[t];return n?`${t}=${n}`:t}}(t)).join("&");return encodeURI(`${e}${n?`?${n}`:""}`)}function n(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}const r=/^function\s*([\w$]+)/,c=["",""];function o(e){if(e.name)return e.name;const[,t]=String(e).match(r)||c;return t}function u(e,t,n){let r=0;const c=n.length;for(;r<c;){if(e(t,n[r],r))return!0;r+=1}return!1}function a(e,t,r=[],c=[]){if(Object.is(e,t))return!0;const u=n(e);if(u!==n(t))return!1;if(null==e||null==t)return!1;switch(u){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===o(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Object.is(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Object.is(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}let s=r.length-1;for(;s>=0;){if(r[s]===e)return c[s]===t;s-=1}switch(u){case"Map":return e.size===t.size&&i(e.entries(),t.entries(),r.concat([e]),c.concat([t]));case"Set":return e.size===t.size&&i(e.values(),t.values(),r.concat([e]),c.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}const f=Object.keys(e);if(f.length!==Object.keys(t).length)return!1;const l=r.concat([e]),g=c.concat([t]);for(s=f.length-1;s>=0;){const n=f[s];if(!Object.prototype.hasOwnProperty.call(t,n)||!a(t[n],e[n],l,g))return!1;s-=1}return!0}function i(e,t,n,r){const c=Array.from(e);function o(e,t){return a(e,t,n.slice(),r.slice())}return!u((e,t)=>!u(o,t,e),Array.from(t),c)}function s(e,t,n=0){if("function"==typeof e.indexOf)switch(typeof t){case"number":let r,c;if(0===t){for(r=1/t;n<e.length;){if(0===(c=e[n])&&1/c===r)return n;n+=1}return-1}if(t!=t){for(;n<e.length;){if("number"==typeof(c=e[n])&&c!=c)return n;n+=1}return-1}return e.indexOf(t,n);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,n);case"object":if(null===t)return e.indexOf(t,n)}for(;n<e.length;){if(a(e[n],t))return n;n+=1}return-1}function f(e,t){let n=0;const r=t.length,c=Array(r);for(;n<r;)c[n]=e(t[n]),n+=1;return c}const l=/\/{2,}/g,g="/",y=e=>"string"==typeof e;const b=[[/\\/g,"\\\\"],[/[\b]/g,"\\b"],[/\f/g,"\\f"],[/\n/g,"\\n"],[/\r/g,"\\r"],[/\t/g,"\\t"],[/\v/g,"\\v"],[/\0/g,"\\0"]],p=[/"/g,'\\"'];function d(e){return'"'+j(b.reduce(j,e),p)+'"'}function j(e,t){return e.replace(t[0],t[1])}e.addQueryParameters=function(e,n){return void 0===n?n=>t(e,n):t(e,n)},e.clone=function e(t,r,c,o){function u(n){const u=r.length;let a=0;for(;a<u;++a)if(t===r[a])return c[a];r[a+1]=t,c[a+1]=n;for(const u in t)t.hasOwnProperty(u)&&(n[u]=o?e(t[u],r,c,!0):t[u]);return n}switch(n(t)){case"Object":return u({});case"Array":return u([]);case"Date":return new Date(t.valueOf());case"RegExp":return a=t,new RegExp(a.source,(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.sticky?"y":"")+(a.unicode?"u":""));default:return t}var a},e.equals=a,e.functionName=o,e.includesWith=u,e.indexOf=s,e.isBrowser=!0,e.mapArrayLike=f,e.mapObj=function(e,t){const n={};for(const r in t)n[r]=e(r,t[r]);return n},e.pathJoin=function(e,t=!1){const n=`/${e.filter(y).join(g)}`.replace(l,g);return t&&"/"!==n[n.length-1]?n+"/":n},e.quote=d,e.toString=e=>(function e(t,n){const r=r=>{const c=n.concat([t]);return s(c,r)>-1?"<Circular>":e(r,c)},c=(e,t)=>f(t=>d(t)+": "+r(e[t]),t.slice().sort());switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+f(r,t).join(", ")+"))";case"[object Array]":return"["+f(r,t).concat(c(t,Object.keys(t).filter(e=>!/^\d+$/.test(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof t?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):d(t.toISOString()))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof t?"new Number("+r(t.valueOf())+")":1/t==-1/0?"-0":t.toString(10);case"[object String]":return"object"==typeof t?"new String("+r(t.valueOf())+")":d(t);case"[object Undefined]":return"undefined";default:if("function"==typeof t.toString){const e=t.toString();if("[object Object]"!==e)return e}return"{"+c(t,Object.keys(t)).join(", ")+"}"}})(e,[]),e.typeOf=n,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).Typed=e.Typed||{},e.Typed.Common={}))}(this,(function(e){"use strict";function t(e,t){const n=Object.keys(t).sort().map(function(e){return t=>{const n=e[t];return n?`${t}=${n}`:t}}(t)).join("&");return encodeURI(`${e}${n?`?${n}`:""}`)}function n(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}const r=/^function\s*([\w$]+)/,c=["",""];function o(e){if(e.name)return e.name;const[,t]=String(e).match(r)||c;return t}function u(e,t,n){let r=0;const c=n.length;for(;r<c;){if(e(t,n[r],r))return!0;r+=1}return!1}function a(e,t,r=[],c=[]){if(Object.is(e,t))return!0;const u=n(e);if(u!==n(t))return!1;if(null==e||null==t)return!1;switch(u){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===o(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Object.is(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Object.is(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}let s=r.length-1;for(;s>=0;){if(r[s]===e)return c[s]===t;s-=1}switch(u){case"Map":return e.size===t.size&&i(e.entries(),t.entries(),r.concat([e]),c.concat([t]));case"Set":return e.size===t.size&&i(e.values(),t.values(),r.concat([e]),c.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}const f=Object.keys(e);if(f.length!==Object.keys(t).length)return!1;const l=r.concat([e]),g=c.concat([t]);for(s=f.length-1;s>=0;){const n=f[s];if(!Object.prototype.hasOwnProperty.call(t,n)||!a(t[n],e[n],l,g))return!1;s-=1}return!0}function i(e,t,n,r){const c=Array.from(e);function o(e,t){return a(e,t,n.slice(),r.slice())}return!u((e,t)=>!u(o,t,e),Array.from(t),c)}function s(e,t,n=0){if("function"==typeof e.indexOf)switch(typeof t){case"number":let r,c;if(0===t){for(r=1/t;n<e.length;){if(c=e[n],0===c&&1/c===r)return n;n+=1}return-1}if(t!=t){for(;n<e.length;){if(c=e[n],"number"==typeof c&&c!=c)return n;n+=1}return-1}return e.indexOf(t,n);case"string":case"boolean":case"function":case"undefined":return e.indexOf(t,n);case"object":if(null===t)return e.indexOf(t,n)}for(;n<e.length;){if(a(e[n],t))return n;n+=1}return-1}function f(e,t){let n=0;const r=t.length,c=Array(r);for(;n<r;)c[n]=e(t[n]),n+=1;return c}const l=/\/{2,}/g,g=e=>"string"==typeof e;const y=[[/\\/g,"\\\\"],[/[\b]/g,"\\b"],[/\f/g,"\\f"],[/\n/g,"\\n"],[/\r/g,"\\r"],[/\t/g,"\\t"],[/\v/g,"\\v"],[/\0/g,"\\0"]],b=[/"/g,'\\"'];function p(e){return'"'+d(y.reduce(d,e),b)+'"'}function d(e,t){return e.replace(t[0],t[1])}e.addQueryParameters=function(e,n){return void 0===n?n=>t(e,n):t(e,n)},e.clone=function e(t,r,c,o){function u(n){const u=r.length;let a=0;for(;a<u;++a)if(t===r[a])return c[a];r[a+1]=t,c[a+1]=n;for(const u in t)t.hasOwnProperty(u)&&(n[u]=o?e(t[u],r,c,!0):t[u]);return n}switch(n(t)){case"Object":return u({});case"Array":return u([]);case"Date":return new Date(t.valueOf());case"RegExp":return a=t,new RegExp(a.source,(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.sticky?"y":"")+(a.unicode?"u":""));default:return t}var a},e.equals=a,e.functionName=o,e.includesWith=u,e.indexOf=s,e.isBrowser=!0,e.mapArrayLike=f,e.mapObj=function(e,t){const n={};for(const r in t)n[r]=e(r,t[r]);return n},e.pathJoin=function(e,t=!1){const n=`/${e.filter(g).join("/")}`.replace(l,"/");return t&&"/"!==n[n.length-1]?n+"/":n},e.quote=p,e.toString=e=>function e(t,n){const r=r=>{const c=n.concat([t]);return s(c,r)>-1?"<Circular>":e(r,c)},c=(e,t)=>f(t=>p(t)+": "+r(e[t]),t.slice().sort());switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+f(r,t).join(", ")+"))";case"[object Array]":return"["+f(r,t).concat(c(t,Object.keys(t).filter(e=>!/^\d+$/.test(e)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof t?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):p(t.toISOString()))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof t?"new Number("+r(t.valueOf())+")":1/t==-1/0?"-0":t.toString(10);case"[object String]":return"object"==typeof t?"new String("+r(t.valueOf())+")":p(t);case"[object Undefined]":return"undefined";default:if("function"==typeof t.toString){const e=t.toString();if("[object Object]"!==e)return e}return"{"+c(t,Object.keys(t)).join(", ")+"}"}}(e,[]),e.typeOf=n,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
321150