codsen-utils 1.6.8 → 1.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codsen-utils.esm.js +3 -3
- package/dist/codsen-utils.umd.js +2 -11
- package/package.json +5 -2
package/dist/codsen-utils.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name codsen-utils
|
|
3
3
|
* @fileoverview Various utility functions
|
|
4
|
-
* @version 1.6.
|
|
4
|
+
* @version 1.6.17
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var i="1.6.
|
|
10
|
+
var i="1.6.17";import p from"rfdc";var l=p(),k=i,a="\u2018",f="\u2019",m="\u201C",d="\u201D",S="\u2013",O="\u2014",C="\xA0",N="\u2026",A="\u200A",j="\u2009",E="\u2032",T="\u2033",J="\\",R="\uFFFD",$="`",L="\xD7",D=[".",",",";","!","?"];function U(t){return r(t)&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}function g(t){return r(t)&&"\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4".includes(t)}function F(t){let e=new Set(["$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);return r(t)&&!!t.trim()&&(g(t)||e.has(t))}function s(t){return r(t)&&t.length===1&&t.toUpperCase()!==t.toLowerCase()}function I(t){return!!(t&&r(t)&&(t.charCodeAt(0)>64&&t.charCodeAt(0)<91||t.charCodeAt(0)>96&&t.charCodeAt(0)<123))}function P(t){return r(t)&&(t==='"'||t==="'"||t===a||t===f||t===m||t===d)}function M(t){return!r(t)||!s(t)?!1:t===t.toLowerCase()&&t!==t.toUpperCase()}function Q(t){return!r(t)||!s(t)?!1:t===t.toUpperCase()&&t!==t.toLowerCase()}function V(t){return!r(t)||!t?!1:!t[0].trim()}var B=t=>r(t)&&t.length&&t.endsWith("/")?t.slice(0,-1).trim():t;function u(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function K(t="",e=0,n=0,o=""){return e<0&&(e+=t.length,e<0&&(e=0)),t.slice(0,e)+(o||"")+t.slice(e+n)}function r(t){return typeof t=="string"}function W(t){return Number.isFinite(t)}function q(t){return Number.isSafeInteger(t)&&t>=0}function H(t){return typeof t=="boolean"}function Z(t){return t===null}function x(t){return t instanceof RegExp}function _(t,e){if(!r(t)||!r(e))return[];let n=[],o=-1;for(;(o=t.indexOf(e,o+1))>=0;)n.push(o);return n}function z(t=[],e=[]){return!t||!Array.isArray(t)||!t.length?[]:!e||!Array.isArray(e)||!e.length?t:t.filter(n=>!e.includes(n))}function G(t){return t!=null}function X(t){return[...new Set(t)]}function b(t){if(!(typeof t!="string"||!t)){if(t.includes(`\r
|
|
11
11
|
`))return`\r
|
|
12
12
|
`;if(t.includes(`
|
|
13
13
|
`))return`
|
|
@@ -16,4 +16,4 @@ var i="1.6.8";import p from"rfdc";var l=p(),k=i,a="\u2018",f="\u2019",d="\u201C"
|
|
|
16
16
|
`,"\r",`
|
|
17
17
|
`].includes(n))throw new Error(`codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as ${JSON.stringify(n,null,0)}`);return e==="crlf"?`\r
|
|
18
18
|
`:e==="cr"?"\r":e==="lf"?`
|
|
19
|
-
`:
|
|
19
|
+
`:b(t)||n}function v(t,e){return u(t)&&r(e)&&e in t}function tt(t,e){return t.localeCompare(e)}var et=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],nt=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function rt(t,e){return!Array.isArray(t)||!t.length?!1:t.some(n=>x(n)&&e.match(n)||typeof n=="string"&&e===n)}function ot(t=[],e=[]){return!t||!e?[]:Array.from(new Set(Array.from(t).filter(n=>new Set(e).has(n))))}function it(t,e=[]){if(!t)return t;if(!u(t))throw new Error(`codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ${JSON.stringify(t,null,4)} (typeof is "${typeof t}")`);let n=l(t);return e.forEach(o=>{delete n[o]}),n}export{J as backslash,$ as backtick,tt as compareFn,b as detectEol,T as doublePrime,N as ellipsis,G as existy,_ as findAllIdx,A as hairspace,v as hasOwnProp,rt as includes,nt as inlineTags,ot as intersection,H as isBool,g as isCurrencyChar,F as isCurrencySymbol,q as isInt,I as isLatinLetter,s as isLetter,M as isLowercaseLetter,Z as isNull,W as isNum,U as isNumberChar,u as isPlainObject,P as isQuote,x as isRegExp,r as isStr,Q as isUppercaseLetter,V as isWhitespaceChar,m as leftDoubleQuote,a as leftSingleQuote,L as multiplicationSign,it as omit,z as pullAll,D as punctuationChars,O as rawMDash,S as rawNDash,C as rawNbsp,R as rawReplacementMark,B as removeTrailingSlash,Y as resolveEolSetting,d as rightDoubleQuote,f as rightSingleQuote,E as singlePrime,K as stringSplice,j as thinSpace,X as uniq,k as version,et as voidTags};
|
package/dist/codsen-utils.umd.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name codsen-utils
|
|
3
3
|
* @fileoverview Various utility functions
|
|
4
|
-
* @version 1.6.
|
|
4
|
+
* @version 1.6.17
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var codsenUtils=(()=>{var R=Object.create;var
|
|
11
|
-
`))return`\r
|
|
12
|
-
`;if(e.includes(`
|
|
13
|
-
`))return`
|
|
14
|
-
`;if(e.includes("\r"))return"\r"}}function je(e,t,n=`
|
|
15
|
-
`){if(![`\r
|
|
16
|
-
`,"\r",`
|
|
17
|
-
`].includes(n))throw new Error(`codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as ${JSON.stringify(n,null,0)}`);return t==="crlf"?`\r
|
|
18
|
-
`:t==="cr"?"\r":t==="lf"?`
|
|
19
|
-
`:B(e)||n}function Ae(e,t){return h(e)&&a(t)&&t in e}function Se(e,t){return e.localeCompare(t)}var Ce=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ne=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function Ee(e,t){return!Array.isArray(e)||!e.length?!1:e.some(n=>D(n)&&t.match(n)||typeof n=="string"&&t===n)}function Te(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(n=>new Set(t).has(n))))}function Je(e,t=[]){if(!e)return e;if(!h(e))throw new Error(`codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ${JSON.stringify(e,null,4)} (typeof is "${typeof e}")`);let n=W(e);return t.forEach(c=>{delete n[c]}),n}return F(De);})();
|
|
10
|
+
"use strict";var codsenUtils=(()=>{var R=Object.create;var m=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),U=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},O=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of L(t))!V.call(e,l)&&l!==n&&m(e,l,{get:()=>t[l],enumerable:!(c=$(t,l))||c.enumerable});return e};var H=(e,t,n)=>(n=e!=null?R(M(e)):{},O(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),F=e=>O(m({},"__esModule",{value:!0}),e);var A=P(($e,j)=>{"use strict";j.exports=Q;function g(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Q(e){if(e=e||{},e.circles)return K(e);let t=new Map;if(t.set(Date,s=>new Date(s)),t.set(Map,(s,u)=>new Map(c(Array.from(s),u))),t.set(Set,(s,u)=>new Set(c(Array.from(s),u))),e.constructorHandlers)for(let s of e.constructorHandlers)t.set(s[0],s[1]);let n=null;return e.proto?y:l;function c(s,u){let r=Object.keys(s),o=new Array(r.length);for(let f=0;f<r.length;f++){let i=r[f],p=s[i];typeof p!="object"||p===null?o[i]=p:p.constructor!==Object&&(n=t.get(p.constructor))?o[i]=n(p,u):ArrayBuffer.isView(p)?o[i]=g(p):o[i]=u(p)}return o}function l(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,l);if(s.constructor!==Object&&(n=t.get(s.constructor)))return n(s,l);let u={};for(let r in s){if(Object.hasOwnProperty.call(s,r)===!1)continue;let o=s[r];typeof o!="object"||o===null?u[r]=o:o.constructor!==Object&&(n=t.get(o.constructor))?u[r]=n(o,l):ArrayBuffer.isView(o)?u[r]=g(o):u[r]=l(o)}return u}function y(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,y);if(s.constructor!==Object&&(n=t.get(s.constructor)))return n(s,y);let u={};for(let r in s){let o=s[r];typeof o!="object"||o===null?u[r]=o:o.constructor!==Object&&(n=t.get(o.constructor))?u[r]=n(o,y):ArrayBuffer.isView(o)?u[r]=g(o):u[r]=y(o)}return u}}function K(e){let t=[],n=[],c=new Map;if(c.set(Date,r=>new Date(r)),c.set(Map,(r,o)=>new Map(y(Array.from(r),o))),c.set(Set,(r,o)=>new Set(y(Array.from(r),o))),e.constructorHandlers)for(let r of e.constructorHandlers)c.set(r[0],r[1]);let l=null;return e.proto?u:s;function y(r,o){let f=Object.keys(r),i=new Array(f.length);for(let p=0;p<f.length;p++){let b=f[p],d=r[b];if(typeof d!="object"||d===null)i[b]=d;else if(d.constructor!==Object&&(l=c.get(d.constructor)))i[b]=l(d,o);else if(ArrayBuffer.isView(d))i[b]=g(d);else{let w=t.indexOf(d);w!==-1?i[b]=n[w]:i[b]=o(d)}}return i}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return y(r,s);if(r.constructor!==Object&&(l=c.get(r.constructor)))return l(r,s);let o={};t.push(r),n.push(o);for(let f in r){if(Object.hasOwnProperty.call(r,f)===!1)continue;let i=r[f];if(typeof i!="object"||i===null)o[f]=i;else if(i.constructor!==Object&&(l=c.get(i.constructor)))o[f]=l(i,s);else if(ArrayBuffer.isView(i))o[f]=g(i);else{let p=t.indexOf(i);p!==-1?o[f]=n[p]:o[f]=s(i)}}return t.pop(),n.pop(),o}function u(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return y(r,u);if(r.constructor!==Object&&(l=c.get(r.constructor)))return l(r,u);let o={};t.push(r),n.push(o);for(let f in r){let i=r[f];if(typeof i!="object"||i===null)o[f]=i;else if(i.constructor!==Object&&(l=c.get(i.constructor)))o[f]=l(i,u);else if(ArrayBuffer.isView(i))o[f]=g(i);else{let p=t.indexOf(i);p!==-1?o[f]=n[p]:o[f]=u(i)}}return t.pop(),n.pop(),o}}});var De={};U(De,{backslash:()=>te,backtick:()=>ne,compareFn:()=>Se,detectEol:()=>B,doublePrime:()=>ee,ellipsis:()=>G,existy:()=>Oe,findAllIdx:()=>he,hairspace:()=>X,hasOwnProp:()=>Ae,includes:()=>Ee,inlineTags:()=>Ne,intersection:()=>Te,isBool:()=>me,isCurrencyChar:()=>J,isCurrencySymbol:()=>ce,isInt:()=>ge,isLatinLetter:()=>ue,isLetter:()=>x,isLowercaseLetter:()=>fe,isNull:()=>xe,isNum:()=>be,isNumberChar:()=>ie,isPlainObject:()=>h,isQuote:()=>le,isRegExp:()=>D,isStr:()=>a,isUppercaseLetter:()=>pe,isWhitespaceChar:()=>ae,leftDoubleQuote:()=>E,leftSingleQuote:()=>C,multiplicationSign:()=>oe,omit:()=>Je,pullAll:()=>we,punctuationChars:()=>se,rawMDash:()=>_,rawNDash:()=>Z,rawNbsp:()=>z,rawReplacementMark:()=>re,removeTrailingSlash:()=>ye,resolveEolSetting:()=>je,rightDoubleQuote:()=>T,rightSingleQuote:()=>N,singlePrime:()=>v,stringSplice:()=>de,thinSpace:()=>Y,uniq:()=>ke,version:()=>q,voidTags:()=>Ce});var k="1.6.17";var S=H(A(),1),W=(0,S.default)(),q=k,C="\u2018",N="\u2019",E="\u201C",T="\u201D",Z="\u2013",_="\u2014",z="\xA0",G="\u2026",X="\u200A",Y="\u2009",v="\u2032",ee="\u2033",te="\\",re="\uFFFD",ne="`",oe="\xD7",se=[".",",",";","!","?"];function ie(e){return a(e)&&e.charCodeAt(0)>=48&&e.charCodeAt(0)<=57}function J(e){return a(e)&&"\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4".includes(e)}function ce(e){let t=new Set(["$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);return a(e)&&!!e.trim()&&(J(e)||t.has(e))}function x(e){return a(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function ue(e){return!!(e&&a(e)&&(e.charCodeAt(0)>64&&e.charCodeAt(0)<91||e.charCodeAt(0)>96&&e.charCodeAt(0)<123))}function le(e){return a(e)&&(e==='"'||e==="'"||e===C||e===N||e===E||e===T)}function fe(e){return!a(e)||!x(e)?!1:e===e.toLowerCase()&&e!==e.toUpperCase()}function pe(e){return!a(e)||!x(e)?!1:e===e.toUpperCase()&&e!==e.toLowerCase()}function ae(e){return!a(e)||!e?!1:!e[0].trim()}var ye=e=>a(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e;function h(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function de(e="",t=0,n=0,c=""){return t<0&&(t+=e.length,t<0&&(t=0)),e.slice(0,t)+(c||"")+e.slice(t+n)}function a(e){return typeof e=="string"}function be(e){return Number.isFinite(e)}function ge(e){return Number.isSafeInteger(e)&&e>=0}function me(e){return typeof e=="boolean"}function xe(e){return e===null}function D(e){return e instanceof RegExp}function he(e,t){if(!a(e)||!a(t))return[];let n=[],c=-1;for(;(c=e.indexOf(t,c+1))>=0;)n.push(c);return n}function we(e=[],t=[]){return!e||!Array.isArray(e)||!e.length?[]:!t||!Array.isArray(t)||!t.length?e:e.filter(n=>!t.includes(n))}function Oe(e){return e!=null}function ke(e){return[...new Set(e)]}function B(e){if(!(typeof e!="string"||!e)){if(e.includes("\r\n"))return"\r\n";if(e.includes("\n"))return"\n";if(e.includes("\r"))return"\r"}}function je(e,t,n="\n"){if(!["\r\n","\r","\n"].includes(n))throw new Error('codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as '.concat(JSON.stringify(n,null,0)));return t==="crlf"?"\r\n":t==="cr"?"\r":t==="lf"?"\n":B(e)||n}function Ae(e,t){return h(e)&&a(t)&&t in e}function Se(e,t){return e.localeCompare(t)}var Ce=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ne=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function Ee(e,t){return!Array.isArray(e)||!e.length?!1:e.some(n=>D(n)&&t.match(n)||typeof n=="string"&&t===n)}function Te(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(n=>new Set(t).has(n))))}function Je(e,t=[]){if(!e)return e;if(!h(e))throw new Error("codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ".concat(JSON.stringify(e,null,4),' (typeof is "').concat(typeof e,'")'));let n=W(e);return t.forEach(c=>{delete n[c]}),n}return F(De);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codsen-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.17",
|
|
4
4
|
"description": "Various utility functions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codsen",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
|
|
36
36
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
37
37
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
38
|
-
"letspublish": "npm publish || :",
|
|
38
|
+
"letspublish": "npm publish --provenance || :",
|
|
39
39
|
"lint": "eslint . --fix",
|
|
40
40
|
"perf": "node perf/check.js",
|
|
41
41
|
"prep": "echo 'ready'",
|
|
@@ -66,5 +66,8 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"rfdc": "^1.4.1"
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
72
|
}
|
|
70
73
|
}
|