devix 0.0.1 → 0.0.13
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/LICENSE +21 -0
- package/README.md +19 -0
- package/dist/index.cjs.js +5 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.esm.js +5 -0
- package/dist/index.umd.js +5 -0
- package/package.json +47 -10
- package/dist/index.js +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenKnights
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# devix
|
|
2
|
+
|
|
3
|
+
Devix is a comprehensive, powerful, and compact JavaScript utility library.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install --save-dev devix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
// Using ES Module
|
|
15
|
+
import { [[ModuleName]] } from 'devix'
|
|
16
|
+
|
|
17
|
+
// Using CommonJS
|
|
18
|
+
var { [[ModuleName]] } = require('devix')
|
|
19
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const t={string:t=>"string"==typeof t,number:t=>"number"==typeof t,boolean:t=>"boolean"==typeof t,null:t=>null===t,undefined:t=>void 0===t,symbol:t=>"symbol"==typeof t,bigint:t=>"bigint"==typeof t,object:t=>null!==t&&"object"==typeof t,array:t=>Array.isArray(t),function:t=>"function"==typeof t,set:t=>t instanceof Set,map:t=>t instanceof Map,date:t=>t instanceof Date,regexp:t=>t instanceof RegExp},e=(e,n)=>t[e]?.(n)||!1;var n;!function(t){t[t.Local=0]="Local",t[t.Session=1]="Session"}(n||(n={}));class o{constructor(t){this.storage=t===n.Local?localStorage:sessionStorage}getCache(t){const e=this.storage.getItem(t);return e?JSON.parse(e):null}setCache(t,e){this.storage.setItem(t,JSON.stringify(e))}updateCache(t,n,o){const r=this.getCache(t);e("object",r)&&(r[n]=o,this.setCache(t,r))}deleteCache(t){this.storage.removeItem(t)}clearCache(){this.storage.clear()}}const r=new o(n.Local),s=new o(n.Session);
|
|
2
|
+
//! Function Deep Copy
|
|
3
|
+
const i=t=>e("object",t)||e("function",t);var c;function a(t,e,n){[t[e],t[n]]=[t[n],t[e]]}function u(t,e,n){return n===c.ASC?t>e:t<e}!function(t){t.ASC="ASC",t.DESC="DESC"}(c||(c={}));const l=new Map([["yyyy","year"],["MM","month"],["dd","day"],["HH","hours"],["mm","minutes"],["ss","seconds"],["W","week"]]),f=new Map([[1,"一"],[2,"二"],[3,"三"],[4,"四"],[5,"五"],[6,"六"],[0,"日"]]);function p(t){return t.toString().padStart(2,"0")}exports.bubblingSort=function(t,e=c.ASC,n){const o=t.length;if(o<2)return t;for(let r=0;r<o-1;r++)for(let s=0;s<o-1-r;s++){u(n?t[s][n]:t[s],n?t[s+1][n]:t[s+1],e)&&a(t,s,s+1)}return t},exports.compose=function(...t){const e=t.length;if(!(e<=0)){for(let n=0;n<e;n++){if("function"!=typeof t[n])throw new Error(`argument with index ${n} is not a function`)}return function(...n){let o=0,r=t[o].apply(this,n);for(;++o<e;)r=t[o].call(this,r);return r}}},exports.currying=function(t){return function e(...n){return n.length>=t.length?t.apply(this,n):function(...t){return e.apply(this,n.concat(t))}}},exports.debounce=function(t,e=0,n=!1){let o=null,r=!1;function s(...s){return new Promise(((i,c)=>{if(null!==o&&clearTimeout(o),!n||r)o=setTimeout((()=>{try{const e=t.apply(this,s);i(e)}catch(t){c(t)}finally{o=null,r=!1}}),e);else{try{const e=t.apply(this,s);i(e)}catch(t){c(t)}r=!0}}))}return s.cancel=function(){null!==o&&clearTimeout(o),o=null,r=!1},s},exports.deepClone=function t(n,o=new WeakMap){if(o.get(n))return o.get(n);const r=function(t,n,o){if(e("symbol",t))return Symbol(t.description);if(!i(t))return t;if(e("set",t)){const e=new Set;return t.forEach((t=>e.add(n(t,o)))),e}if(e("map",t)){const e=new Map;return t.forEach(((t,r)=>e.set(r,n(t,o)))),e}}(n,t,o);if(r)return r;const s=e("array",n),c=s?[]:{};return o.set(n,c),s?n.forEach(((e,n)=>{c[n]=t(e,o)})):(Object.keys(n).forEach((e=>{c[e]=t(n[e],o)})),Object.getOwnPropertySymbols(n).forEach((e=>{c[Symbol(e.description)]=t(n[e],o)}))),c},exports.formatTimer=(t,n="yyyy-MM-dd HH:mm:ss")=>{if(!t)return(new Date).toISOString();const o=function(t){const e=0===t.getDay()?7:t.getDay();return{year:t.getFullYear().toString(),month:p(t.getMonth()+1),day:p(t.getDate()),hours:p(t.getHours()),minutes:p(t.getMinutes()),seconds:p(t.getSeconds()),week:(n=e,f.get(n)||""),weekNum:e.toString()};var n}(new Date(t));if(e("string",n)&&!n.trim())return o;return Array.from(l).reduce(((t,[e,n])=>t.replace(new RegExp(e,"g"),o[n])),n)},exports.insertStr=function(t,e,n){return t.slice(0,e)+n+t.slice(e)},exports.isType=e,exports.localCache=r,exports.sessionCache=s,exports.setTimer=function(t,e,n){let o=null;const r=()=>{t(),o=setTimeout(r,e)};return n&&t(),setTimeout(r,e),{cancel:()=>{null!==o&&clearTimeout(o)}}},exports.shallowClone=
|
|
4
|
+
//! Function Shallow Copy
|
|
5
|
+
function(t){return e("array",t)?t.slice():e("object",t)?{...t}:t},exports.stringCase=function(t,e="",n=""){const o=t.split(e);for(let t=0;t<o.length;t++)o[t]=o[t].slice(0,1).toUpperCase()+o[t].slice(1).toLowerCase();return o.join(n)},exports.throttle=function(t,e,n={}){const{leading:o=!0,trailing:r=!1}=n;let s=0,i=null;function c(...n){return new Promise(((c,a)=>{try{const a=Date.now();let u;o||0!==s||(s=a);const l=e-(a-s);if(l<=0)return i&&clearTimeout(i),u=t.apply(this,n),c(u),s=a,void(i=null);r&&!i&&(i=setTimeout((()=>{u=t.apply(this,n),c(u),s=Date.now(),i=null}),l))}catch(t){a(t)}}))}return c.cancel=function(){i&&clearTimeout(i),s=0,i=null},c};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare function currying(fn: Function): (this: any, ...args: any[]) => any;
|
|
2
|
+
declare function compose(...fns: Function[]): ((this: any, ...args: any[]) => any) | undefined;
|
|
3
|
+
declare function insertStr(soure: string, start: number, newStr: string): string;
|
|
4
|
+
declare function stringCase(soure: string, separator?: string, separate?: string): string;
|
|
5
|
+
declare function setTimer(execute: (...args: any[]) => any, delay: number, immediate: boolean): {
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
declare const isType: (type: string, target: any) => boolean;
|
|
10
|
+
|
|
11
|
+
declare enum CacheType {
|
|
12
|
+
Local = 0,
|
|
13
|
+
Session = 1
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Encapsulate storage cache class
|
|
17
|
+
*
|
|
18
|
+
* @class StorageCache
|
|
19
|
+
* @template T
|
|
20
|
+
*/
|
|
21
|
+
declare class StorageCache<T = any> {
|
|
22
|
+
private storage;
|
|
23
|
+
constructor(type: CacheType);
|
|
24
|
+
getCache(key: string): T;
|
|
25
|
+
setCache(key: string, value: T): void;
|
|
26
|
+
updateCache(key: string, property: string, value: T): void;
|
|
27
|
+
deleteCache(key: string): void;
|
|
28
|
+
clearCache(): void;
|
|
29
|
+
}
|
|
30
|
+
declare const localCache: StorageCache<any>;
|
|
31
|
+
declare const sessionCache: StorageCache<any>;
|
|
32
|
+
|
|
33
|
+
interface ITimerObj {
|
|
34
|
+
year: string;
|
|
35
|
+
month: string;
|
|
36
|
+
day: string;
|
|
37
|
+
hours: string;
|
|
38
|
+
minutes: string;
|
|
39
|
+
seconds: string;
|
|
40
|
+
week: string;
|
|
41
|
+
weekNum: string;
|
|
42
|
+
}
|
|
43
|
+
type TFormatTimer = (cellValue: string | number | Date, formatType?: string) => string | ITimerObj;
|
|
44
|
+
type ThrottleOptions = {
|
|
45
|
+
leading?: boolean;
|
|
46
|
+
trailing?: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare function debounce<T extends (...args: any[]) => any>(callback: T, delay?: number, immediate?: boolean): ((...args: Parameters<T>) => Promise<ReturnType<T>>) & {
|
|
50
|
+
cancel: () => void;
|
|
51
|
+
};
|
|
52
|
+
declare function throttle<T extends (...args: any[]) => any>(callback: T, interval: number, options?: ThrottleOptions): ((...args: Parameters<T>) => Promise<ReturnType<T>>) & {
|
|
53
|
+
cancel: () => void;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
declare function shallowClone<T = any>(source: T): T;
|
|
57
|
+
declare function deepClone(source: any, hash?: WeakMap<object, any>): any;
|
|
58
|
+
|
|
59
|
+
declare enum SortType {
|
|
60
|
+
ASC = "ASC",
|
|
61
|
+
DESC = "DESC"
|
|
62
|
+
}
|
|
63
|
+
declare function bubblingSort<T>(array: T[], type?: SortType, key?: keyof T): T[];
|
|
64
|
+
|
|
65
|
+
declare const formatTimer: TFormatTimer;
|
|
66
|
+
|
|
67
|
+
export { bubblingSort, compose, currying, debounce, deepClone, formatTimer, insertStr, isType, localCache, sessionCache, setTimer, shallowClone, stringCase, throttle };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
function t(t){return function e(...n){return n.length>=t.length?t.apply(this,n):function(...t){return e.apply(this,n.concat(t))}}}function e(...t){const e=t.length;if(!(e<=0)){for(let n=0;n<e;n++){if("function"!=typeof t[n])throw new Error(`argument with index ${n} is not a function`)}return function(...n){let o=0,r=t[o].apply(this,n);for(;++o<e;)r=t[o].call(this,r);return r}}}function n(t,e,n){return t.slice(0,e)+n+t.slice(e)}function o(t,e="",n=""){const o=t.split(e);for(let t=0;t<o.length;t++)o[t]=o[t].slice(0,1).toUpperCase()+o[t].slice(1).toLowerCase();return o.join(n)}function r(t,e,n){let o=null;const r=()=>{t(),o=setTimeout(r,e)};return n&&t(),setTimeout(r,e),{cancel:()=>{null!==o&&clearTimeout(o)}}}const c={string:t=>"string"==typeof t,number:t=>"number"==typeof t,boolean:t=>"boolean"==typeof t,null:t=>null===t,undefined:t=>void 0===t,symbol:t=>"symbol"==typeof t,bigint:t=>"bigint"==typeof t,object:t=>null!==t&&"object"==typeof t,array:t=>Array.isArray(t),function:t=>"function"==typeof t,set:t=>t instanceof Set,map:t=>t instanceof Map,date:t=>t instanceof Date,regexp:t=>t instanceof RegExp},i=(t,e)=>c[t]?.(e)||!1;var s;!function(t){t[t.Local=0]="Local",t[t.Session=1]="Session"}(s||(s={}));class a{constructor(t){this.storage=t===s.Local?localStorage:sessionStorage}getCache(t){const e=this.storage.getItem(t);return e?JSON.parse(e):null}setCache(t,e){this.storage.setItem(t,JSON.stringify(e))}updateCache(t,e,n){const o=this.getCache(t);i("object",o)&&(o[e]=n,this.setCache(t,o))}deleteCache(t){this.storage.removeItem(t)}clearCache(){this.storage.clear()}}const u=new a(s.Local),l=new a(s.Session);function f(t,e=0,n=!1){let o=null,r=!1;function c(...c){return new Promise(((i,s)=>{if(null!==o&&clearTimeout(o),!n||r)o=setTimeout((()=>{try{const e=t.apply(this,c);i(e)}catch(t){s(t)}finally{o=null,r=!1}}),e);else{try{const e=t.apply(this,c);i(e)}catch(t){s(t)}r=!0}}))}return c.cancel=function(){null!==o&&clearTimeout(o),o=null,r=!1},c}function y(t,e,n={}){const{leading:o=!0,trailing:r=!1}=n;let c=0,i=null;function s(...n){return new Promise(((s,a)=>{try{const a=Date.now();let u;o||0!==c||(c=a);const l=e-(a-c);if(l<=0)return i&&clearTimeout(i),u=t.apply(this,n),s(u),c=a,void(i=null);r&&!i&&(i=setTimeout((()=>{u=t.apply(this,n),s(u),c=Date.now(),i=null}),l))}catch(t){a(t)}}))}return s.cancel=function(){i&&clearTimeout(i),c=0,i=null},s}
|
|
2
|
+
//! Function Shallow Copy
|
|
3
|
+
function g(t){return i("array",t)?t.slice():i("object",t)?{...t}:t}
|
|
4
|
+
//! Function Deep Copy
|
|
5
|
+
const p=t=>i("object",t)||i("function",t);function h(t,e=new WeakMap){if(e.get(t))return e.get(t);const n=function(t,e,n){if(i("symbol",t))return Symbol(t.description);if(!p(t))return t;if(i("set",t)){const o=new Set;return t.forEach((t=>o.add(e(t,n)))),o}if(i("map",t)){const o=new Map;return t.forEach(((t,r)=>o.set(r,e(t,n)))),o}}(t,h,e);if(n)return n;const o=i("array",t),r=o?[]:{};return e.set(t,r),o?t.forEach(((t,n)=>{r[n]=h(t,e)})):(Object.keys(t).forEach((n=>{r[n]=h(t[n],e)})),Object.getOwnPropertySymbols(t).forEach((n=>{r[Symbol(n.description)]=h(t[n],e)}))),r}var m;function S(t,e,n){[t[e],t[n]]=[t[n],t[e]]}function d(t,e,n){return n===m.ASC?t>e:t<e}function w(t,e=m.ASC,n){const o=t.length;if(o<2)return t;for(let r=0;r<o-1;r++)for(let c=0;c<o-1-r;c++){d(n?t[c][n]:t[c],n?t[c+1][n]:t[c+1],e)&&S(t,c,c+1)}return t}!function(t){t.ASC="ASC",t.DESC="DESC"}(m||(m={}));const b=new Map([["yyyy","year"],["MM","month"],["dd","day"],["HH","hours"],["mm","minutes"],["ss","seconds"],["W","week"]]),C=new Map([[1,"一"],[2,"二"],[3,"三"],[4,"四"],[5,"五"],[6,"六"],[0,"日"]]);function M(t){return t.toString().padStart(2,"0")}const D=(t,e="yyyy-MM-dd HH:mm:ss")=>{if(!t)return(new Date).toISOString();const n=function(t){const e=0===t.getDay()?7:t.getDay();return{year:t.getFullYear().toString(),month:M(t.getMonth()+1),day:M(t.getDate()),hours:M(t.getHours()),minutes:M(t.getMinutes()),seconds:M(t.getSeconds()),week:(n=e,C.get(n)||""),weekNum:e.toString()};var n}(new Date(t));if(i("string",e)&&!e.trim())return n;return Array.from(b).reduce(((t,[e,o])=>t.replace(new RegExp(e,"g"),n[o])),e)};export{w as bubblingSort,e as compose,t as currying,f as debounce,h as deepClone,D as formatTimer,n as insertStr,i as isType,u as localCache,l as sessionCache,r as setTimer,g as shallowClone,o as stringCase,y as throttle};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Evenex={})}(this,(function(t){"use strict";const e={string:t=>"string"==typeof t,number:t=>"number"==typeof t,boolean:t=>"boolean"==typeof t,null:t=>null===t,undefined:t=>void 0===t,symbol:t=>"symbol"==typeof t,bigint:t=>"bigint"==typeof t,object:t=>null!==t&&"object"==typeof t,array:t=>Array.isArray(t),function:t=>"function"==typeof t,set:t=>t instanceof Set,map:t=>t instanceof Map,date:t=>t instanceof Date,regexp:t=>t instanceof RegExp},n=(t,n)=>e[t]?.(n)||!1;var o;!function(t){t[t.Local=0]="Local",t[t.Session=1]="Session"}(o||(o={}));class r{constructor(t){this.storage=t===o.Local?localStorage:sessionStorage}getCache(t){const e=this.storage.getItem(t);return e?JSON.parse(e):null}setCache(t,e){this.storage.setItem(t,JSON.stringify(e))}updateCache(t,e,o){const r=this.getCache(t);n("object",r)&&(r[e]=o,this.setCache(t,r))}deleteCache(t){this.storage.removeItem(t)}clearCache(){this.storage.clear()}}const i=new r(o.Local),s=new r(o.Session);
|
|
2
|
+
//! Function Deep Copy
|
|
3
|
+
const c=t=>n("object",t)||n("function",t);var a;function u(t,e,n){[t[e],t[n]]=[t[n],t[e]]}function l(t,e,n){return n===a.ASC?t>e:t<e}!function(t){t.ASC="ASC",t.DESC="DESC"}(a||(a={}));const f=new Map([["yyyy","year"],["MM","month"],["dd","day"],["HH","hours"],["mm","minutes"],["ss","seconds"],["W","week"]]),y=new Map([[1,"一"],[2,"二"],[3,"三"],[4,"四"],[5,"五"],[6,"六"],[0,"日"]]);function p(t){return t.toString().padStart(2,"0")}t.bubblingSort=function(t,e=a.ASC,n){const o=t.length;if(o<2)return t;for(let r=0;r<o-1;r++)for(let i=0;i<o-1-r;i++){l(n?t[i][n]:t[i],n?t[i+1][n]:t[i+1],e)&&u(t,i,i+1)}return t},t.compose=function(...t){const e=t.length;if(!(e<=0)){for(let n=0;n<e;n++){if("function"!=typeof t[n])throw new Error(`argument with index ${n} is not a function`)}return function(...n){let o=0,r=t[o].apply(this,n);for(;++o<e;)r=t[o].call(this,r);return r}}},t.currying=function(t){return function e(...n){return n.length>=t.length?t.apply(this,n):function(...t){return e.apply(this,n.concat(t))}}},t.debounce=function(t,e=0,n=!1){let o=null,r=!1;function i(...i){return new Promise(((s,c)=>{if(null!==o&&clearTimeout(o),!n||r)o=setTimeout((()=>{try{const e=t.apply(this,i);s(e)}catch(t){c(t)}finally{o=null,r=!1}}),e);else{try{const e=t.apply(this,i);s(e)}catch(t){c(t)}r=!0}}))}return i.cancel=function(){null!==o&&clearTimeout(o),o=null,r=!1},i},t.deepClone=function t(e,o=new WeakMap){if(o.get(e))return o.get(e);const r=function(t,e,o){if(n("symbol",t))return Symbol(t.description);if(!c(t))return t;if(n("set",t)){const n=new Set;return t.forEach((t=>n.add(e(t,o)))),n}if(n("map",t)){const n=new Map;return t.forEach(((t,r)=>n.set(r,e(t,o)))),n}}(e,t,o);if(r)return r;const i=n("array",e),s=i?[]:{};return o.set(e,s),i?e.forEach(((e,n)=>{s[n]=t(e,o)})):(Object.keys(e).forEach((n=>{s[n]=t(e[n],o)})),Object.getOwnPropertySymbols(e).forEach((n=>{s[Symbol(n.description)]=t(e[n],o)}))),s},t.formatTimer=(t,e="yyyy-MM-dd HH:mm:ss")=>{if(!t)return(new Date).toISOString();const o=function(t){const e=0===t.getDay()?7:t.getDay();return{year:t.getFullYear().toString(),month:p(t.getMonth()+1),day:p(t.getDate()),hours:p(t.getHours()),minutes:p(t.getMinutes()),seconds:p(t.getSeconds()),week:(n=e,y.get(n)||""),weekNum:e.toString()};var n}(new Date(t));if(n("string",e)&&!e.trim())return o;return Array.from(f).reduce(((t,[e,n])=>t.replace(new RegExp(e,"g"),o[n])),e)},t.insertStr=function(t,e,n){return t.slice(0,e)+n+t.slice(e)},t.isType=n,t.localCache=i,t.sessionCache=s,t.setTimer=function(t,e,n){let o=null;const r=()=>{t(),o=setTimeout(r,e)};return n&&t(),setTimeout(r,e),{cancel:()=>{null!==o&&clearTimeout(o)}}},t.shallowClone=
|
|
4
|
+
//! Function Shallow Copy
|
|
5
|
+
function(t){return n("array",t)?t.slice():n("object",t)?{...t}:t},t.stringCase=function(t,e="",n=""){const o=t.split(e);for(let t=0;t<o.length;t++)o[t]=o[t].slice(0,1).toUpperCase()+o[t].slice(1).toLowerCase();return o.join(n)},t.throttle=function(t,e,n={}){const{leading:o=!0,trailing:r=!1}=n;let i=0,s=null;function c(...n){return new Promise(((c,a)=>{try{const a=Date.now();let u;o||0!==i||(i=a);const l=e-(a-i);if(l<=0)return s&&clearTimeout(s),u=t.apply(this,n),c(u),i=a,void(s=null);r&&!s&&(s=setTimeout((()=>{u=t.apply(this,n),c(u),i=Date.now(),s=null}),l))}catch(t){a(t)}}))}return c.cancel=function(){s&&clearTimeout(s),i=0,s=null},c}}));
|
package/package.json
CHANGED
|
@@ -1,19 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devix",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.13",
|
|
5
|
+
"description": "Devix is a comprehensive, powerful, and compact JavaScript utility library.",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"devix",
|
|
10
|
+
"utils",
|
|
11
|
+
"tools",
|
|
12
|
+
"develop"
|
|
13
|
+
],
|
|
5
14
|
"exports": {
|
|
6
15
|
".": {
|
|
7
|
-
"import": "./dist/index.js",
|
|
8
|
-
"require": "./dist/index.js"
|
|
16
|
+
"import": "./dist/index.esm.js",
|
|
17
|
+
"require": "./dist/index.cjs.js"
|
|
9
18
|
}
|
|
10
19
|
},
|
|
11
|
-
"main": "dist/index.js",
|
|
12
|
-
"module": "dist/index.js",
|
|
20
|
+
"main": "./dist/index.cjs.js",
|
|
21
|
+
"module": "./dist/index.esm.js",
|
|
22
|
+
"umd": "./dist/index.umd.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
13
27
|
"scripts": {
|
|
14
|
-
"
|
|
28
|
+
"build": "rollup -c",
|
|
29
|
+
"dev": "yarn build --watch",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"lint": "eslint src/**/*.{js,jsx,ts,tsx,json}",
|
|
32
|
+
"prettier": "prettier --config .prettierrc.json --write ./**/**/*.{js,jsx,ts,tsx,json}"
|
|
15
33
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@babel/core": "^7.24.0",
|
|
36
|
+
"@babel/preset-env": "^7.24.0",
|
|
37
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
38
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
39
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
40
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
42
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
|
44
|
+
"@typescript-eslint/parser": "^7.3.1",
|
|
45
|
+
"eslint": "^8.57.0",
|
|
46
|
+
"eslint-config-prettier": "^9.1.0",
|
|
47
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"prettier": "^3.2.5",
|
|
50
|
+
"rollup": "^4.13.0",
|
|
51
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
52
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
53
|
+
"tslib": "^2.6.2",
|
|
54
|
+
"typescript": "^5.4.2"
|
|
55
|
+
}
|
|
19
56
|
}
|
package/dist/index.js
DELETED
|
File without changes
|