@zthun/helpful-fn 0.2.0 → 0.3.0
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/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(n,
|
|
1
|
+
let n;const r=new Uint8Array(16);function t(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const o=[];for(let n=0;n<256;++n)o.push((n+256).toString(16).slice(1));var e={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},u=function(n,r,u){if(e.randomUUID&&!r&&!n)return e.randomUUID();const i=(n=n||{}).random||(n.rng||t)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,r){u=u||0;for(let n=0;n<16;++n)r[u+n]=i[n];return r}return function(n,r=0){return(o[n[r+0]]+o[n[r+1]]+o[n[r+2]]+o[n[r+3]]+"-"+o[n[r+4]]+o[n[r+5]]+"-"+o[n[r+6]]+o[n[r+7]]+"-"+o[n[r+8]]+o[n[r+9]]+"-"+o[n[r+10]]+o[n[r+11]]+o[n[r+12]]+o[n[r+13]]+o[n[r+14]]+o[n[r+15]]).toLowerCase()}(i)};function i(n,r){var t=[].slice.call(arguments,2);if(null!=r)return r;for(var o=0;o<t.length;++o){var e=t[o];if(null!=e)return e}return n}function l(n){return[].slice.call(arguments,1).map(function(n){return n instanceof Array?n[1]?n[0]:null:n}).filter(function(n){return null!=n}).join(n)}var c=l.bind(null," "),a=c,d=l.bind(null,","),f=l.bind(null,";"),p=l.bind(null,"|");function s(n,r,t){n(null!=t&&t.length?t[0]:r)}function m(n){return void 0===n&&(n=0),new Promise(function(r){return setTimeout(r,n)})}export{d as commaJoinDefined,u as createGuid,a as cssJoinDefined,i as firstDefined,l as joinDefined,p as pipeJoinDefined,f as semiColonJoinDefined,s as setFirst,m as sleep,c as spaceJoinDefined};
|
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(n){return[].slice.call(arguments,1).map(function(n){return n instanceof Array?n[1]?n[0]:null:n}).filter(function(n){return null!=n}).join(n)}var
|
|
1
|
+
let n;const e=new Uint8Array(16);function r(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(e)}const t=[];for(let n=0;n<256;++n)t.push((n+256).toString(16).slice(1));var o={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function i(n){return[].slice.call(arguments,1).map(function(n){return n instanceof Array?n[1]?n[0]:null:n}).filter(function(n){return null!=n}).join(n)}var u=i.bind(null," "),l=u,s=i.bind(null,","),c=i.bind(null,";"),d=i.bind(null,"|");exports.commaJoinDefined=s,exports.createGuid=function(n,e,i){if(o.randomUUID&&!e&&!n)return o.randomUUID();const u=(n=n||{}).random||(n.rng||r)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,e){i=i||0;for(let n=0;n<16;++n)e[i+n]=u[n];return e}return function(n,e=0){return(t[n[e+0]]+t[n[e+1]]+t[n[e+2]]+t[n[e+3]]+"-"+t[n[e+4]]+t[n[e+5]]+"-"+t[n[e+6]]+t[n[e+7]]+"-"+t[n[e+8]]+t[n[e+9]]+"-"+t[n[e+10]]+t[n[e+11]]+t[n[e+12]]+t[n[e+13]]+t[n[e+14]]+t[n[e+15]]).toLowerCase()}(u)},exports.cssJoinDefined=l,exports.firstDefined=function(n,e){var r=[].slice.call(arguments,2);if(null!=e)return e;for(var t=0;t<r.length;++t){var o=r[t];if(null!=o)return o}return n},exports.joinDefined=i,exports.pipeJoinDefined=d,exports.semiColonJoinDefined=c,exports.setFirst=function(n,e,r){n(null!=r&&r.length?r[0]:e)},exports.sleep=function(n){return void 0===n&&(n=0),new Promise(function(e){return setTimeout(e,n)})},exports.spaceJoinDefined=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createGuid: () => string;
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/helpful-fn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Helpful, isolated pure functions that are not found in other libraries such as lodash.",
|
|
5
5
|
"author": "Anthony Bonta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"microbundle": "^0.15.1",
|
|
23
|
+
"uuid": "^9.0.0",
|
|
23
24
|
"vite": "^4.1.4",
|
|
24
25
|
"vitest": "^0.28.5"
|
|
25
26
|
},
|
|
@@ -27,5 +28,5 @@
|
|
|
27
28
|
"dist"
|
|
28
29
|
],
|
|
29
30
|
"sideEffects": false,
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "1f00bfd207264ee7ea6e3b18292020737434e31b"
|
|
31
32
|
}
|