@koine/utils 2.0.0-beta.127 → 2.0.0-beta.129
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/clsx.cjs.js +0 -1
- package/clsx.esm.js +0 -1
- package/debouncePromise.cjs.js +0 -1
- package/debouncePromise.esm.js +0 -1
- package/debounceRaf.cjs.js +1 -2
- package/debounceRaf.esm.js +1 -2
- package/matchSorter.cjs.js +4 -2
- package/matchSorter.esm.js +4 -2
- package/package.json +1 -1
- package/titleCase.cjs.js +0 -1
- package/titleCase.esm.js +0 -1
- package/tryUntil.cjs.js +1 -3
- package/tryUntil.esm.js +1 -3
package/clsx.cjs.js
CHANGED
|
@@ -7,7 +7,6 @@ let e=t=>{let r,f,l="";if("string"==typeof t||"number"==typeof t)l+=t;else if("o
|
|
|
7
7
|
*
|
|
8
8
|
* @category impl
|
|
9
9
|
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
10
|
-
* @license MIT Luke Edwards https://github.com/lukeed/clsx/blob/master/license
|
|
11
10
|
*/let clsx=function(){let t=0,r,f,l="";for(;t<arguments.length;)// eslint-disable-next-line prefer-rest-params
|
|
12
11
|
(r=arguments[t++])&&(f=e(r))&&(l&&(l+=" "),l+=f);return l};
|
|
13
12
|
|
package/clsx.esm.js
CHANGED
|
@@ -3,7 +3,6 @@ let e=t=>{let r,f,l="";if("string"==typeof t||"number"==typeof t)l+=t;else if("o
|
|
|
3
3
|
*
|
|
4
4
|
* @category impl
|
|
5
5
|
* @borrows [lukeed/clsx](https://github.com/lukeed/clsx)
|
|
6
|
-
* @license MIT Luke Edwards https://github.com/lukeed/clsx/blob/master/license
|
|
7
6
|
*/let clsx=function(){let t=0,r,f,l="";for(;t<arguments.length;)// eslint-disable-next-line prefer-rest-params
|
|
8
7
|
(r=arguments[t++])&&(f=e(r))&&(l&&(l+=" "),l+=f);return l};
|
|
9
8
|
|
package/debouncePromise.cjs.js
CHANGED
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
15
15
|
*
|
|
16
16
|
* @category function
|
|
17
17
|
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
18
|
-
* @license MIT: Jakub Chodorowicz
|
|
19
18
|
*/let debouncePromise=(e,t=50,o={})=>{let i;let n=o.isImmediate??!1,r=o.callback??!1,a=o.maxWait,l=Date.now(),u=[],c=function(...o){// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
20
19
|
let c=this;return new Promise((f,d)=>{let m=n&&void 0===i;if(void 0!==i&&clearTimeout(i),i=setTimeout(function(){if(i=void 0,l=Date.now(),!n){let t=e.apply(c,o);r&&r(t),u.forEach(({resolve:e})=>e(t)),u=[];}},function(){if(void 0!==a){let e=Date.now()-l;if(e+t>=a)return a-e}return t}()),m){let t=e.apply(c,o);return r&&r(t),f(t)}u.push({resolve:f,reject:d});})};return c.cancel=function(e){void 0!==i&&clearTimeout(i),u.forEach(({reject:t})=>t(e)),u=[];},c};
|
|
21
20
|
|
package/debouncePromise.esm.js
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @category function
|
|
13
13
|
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
14
|
-
* @license MIT: Jakub Chodorowicz
|
|
15
14
|
*/let debouncePromise=(e,t=50,o={})=>{let i;let n=o.isImmediate??!1,r=o.callback??!1,a=o.maxWait,l=Date.now(),u=[],c=function(...o){// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
16
15
|
let c=this;return new Promise((f,d)=>{let m=n&&void 0===i;if(void 0!==i&&clearTimeout(i),i=setTimeout(function(){if(i=void 0,l=Date.now(),!n){let t=e.apply(c,o);r&&r(t),u.forEach(({resolve:e})=>e(t)),u=[];}},function(){if(void 0!==a){let e=Date.now()-l;if(e+t>=a)return a-e}return t}()),m){let t=e.apply(c,o);return r&&r(t),f(t)}u.push({resolve:f,reject:d});})};return c.cancel=function(e){void 0!==i&&clearTimeout(i),u.forEach(({reject:t})=>t(e)),u=[];},c};
|
|
17
16
|
|
package/debounceRaf.cjs.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
* Debounce function (with `requestAnimationFrame`)
|
|
7
7
|
*
|
|
8
8
|
* @category function
|
|
9
|
-
* @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
|
|
10
|
-
* @license (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
|
|
9
|
+
* @borrows [vanillajstoolkit/debounce by Chris Ferdinandi](https://vanillajstoolkit.com/helpers/debounce/)
|
|
11
10
|
*/function debounceRaf(n){let e;return function(...t){// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
12
11
|
let o=this;// If there's a timer, cancel it
|
|
13
12
|
e&&window.cancelAnimationFrame(e),// Setup the new requestAnimationFrame()
|
package/debounceRaf.esm.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Debounce function (with `requestAnimationFrame`)
|
|
3
3
|
*
|
|
4
4
|
* @category function
|
|
5
|
-
* @borrows [vanillajstoolkit/debounce](https://vanillajstoolkit.com/helpers/debounce/)
|
|
6
|
-
* @license (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
|
|
5
|
+
* @borrows [vanillajstoolkit/debounce by Chris Ferdinandi](https://vanillajstoolkit.com/helpers/debounce/)
|
|
7
6
|
*/function debounceRaf(n){let e;return function(...t){// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8
7
|
let o=this;// If there's a timer, cancel it
|
|
9
8
|
e&&window.cancelAnimationFrame(e),// Setup the new requestAnimationFrame()
|
package/matchSorter.cjs.js
CHANGED
|
@@ -7,6 +7,9 @@ var removeAccents = require('./removeAccents.cjs.js');
|
|
|
7
7
|
|
|
8
8
|
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
|
|
9
9
|
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
10
|
+
*
|
|
11
|
+
* @borrows [kentcdodds/match-sorter](https://github.com/kentcdodds/match-sorter)
|
|
12
|
+
*
|
|
10
13
|
* @param {Array} items - the items to sort
|
|
11
14
|
* @param {String} value - the value to use for ranking
|
|
12
15
|
* @param {Object} options - Some options to configure the sorter
|
|
@@ -72,8 +75,7 @@ r(e,t):n<a?-1:1},/**
|
|
|
72
75
|
* @param {Object} item - the item
|
|
73
76
|
* @param {Object|Function} key - the potentially nested keypath or property callback
|
|
74
77
|
* @return {Array} - an array containing the value(s) at the nested keypath
|
|
75
|
-
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))//
|
|
76
|
-
return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
78
|
+
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
77
79
|
null==r?[]:Array.isArray(r)?r:[String(r)])},/**
|
|
78
80
|
* Given path: "foo.bar.baz"
|
|
79
81
|
* And item: {foo: {bar: {baz: 'buzz'}}}
|
package/matchSorter.esm.js
CHANGED
|
@@ -3,6 +3,9 @@ import { removeAccents } from './removeAccents.esm.js';
|
|
|
3
3
|
|
|
4
4
|
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
|
|
5
5
|
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
6
|
+
*
|
|
7
|
+
* @borrows [kentcdodds/match-sorter](https://github.com/kentcdodds/match-sorter)
|
|
8
|
+
*
|
|
6
9
|
* @param {Array} items - the items to sort
|
|
7
10
|
* @param {String} value - the value to use for ranking
|
|
8
11
|
* @param {Object} options - Some options to configure the sorter
|
|
@@ -68,8 +71,7 @@ r(e,t):n<a?-1:1},/**
|
|
|
68
71
|
* @param {Object} item - the item
|
|
69
72
|
* @param {Object|Function} key - the potentially nested keypath or property callback
|
|
70
73
|
* @return {Array} - an array containing the value(s) at the nested keypath
|
|
71
|
-
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))//
|
|
72
|
-
return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
74
|
+
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
73
75
|
null==r?[]:Array.isArray(r)?r:[String(r)])},/**
|
|
74
76
|
* Given path: "foo.bar.baz"
|
|
75
77
|
* And item: {foo: {bar: {baz: 'buzz'}}}
|
package/package.json
CHANGED
package/titleCase.cjs.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
* @category text
|
|
7
7
|
*
|
|
8
8
|
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts)
|
|
9
|
-
* @license Blake Embrey (hello@blakeembrey.com)
|
|
10
9
|
*/let titleCase=e=>e?e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()):"";
|
|
11
10
|
|
|
12
11
|
exports.default = titleCase;
|
package/titleCase.esm.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @category text
|
|
3
3
|
*
|
|
4
4
|
* @borrows [blakeembrey/change-case](https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts)
|
|
5
|
-
* @license Blake Embrey (hello@blakeembrey.com)
|
|
6
5
|
*/let titleCase=e=>e?e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()):"";
|
|
7
6
|
|
|
8
7
|
export { titleCase as default, titleCase };
|
package/tryUntil.cjs.js
CHANGED
|
@@ -12,9 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
* @param interval in `ms`
|
|
13
13
|
*/let tryUntil=(t,e,l,n,r)=>{// return new Promise((resolve, reject) => {
|
|
14
14
|
let a=new Date,c=setInterval(function(){t()?(// console.log("resolved after", new Date() - timeWas, "ms");
|
|
15
|
-
clearInterval(c),n())
|
|
16
|
-
new Date-a>e&&(// Timeout
|
|
17
|
-
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
15
|
+
clearInterval(c),n()):new Date-a>e&&(// console.log("rejected after", new Date() - timeWas, "ms");
|
|
18
16
|
clearInterval(c),r&&r());},l);};// });
|
|
19
17
|
|
|
20
18
|
exports.default = tryUntil;
|
package/tryUntil.esm.js
CHANGED
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
* @param interval in `ms`
|
|
9
9
|
*/let tryUntil=(t,e,l,n,r)=>{// return new Promise((resolve, reject) => {
|
|
10
10
|
let a=new Date,c=setInterval(function(){t()?(// console.log("resolved after", new Date() - timeWas, "ms");
|
|
11
|
-
clearInterval(c),n())
|
|
12
|
-
new Date-a>e&&(// Timeout
|
|
13
|
-
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
11
|
+
clearInterval(c),n()):new Date-a>e&&(// console.log("rejected after", new Date() - timeWas, "ms");
|
|
14
12
|
clearInterval(c),r&&r());},l);};// });
|
|
15
13
|
|
|
16
14
|
export { tryUntil as default, tryUntil };
|