kontroll 1.1.1 → 1.1.2
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/index.mjs +1 -1
- package/package.json +16 -28
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={};function c(n){const e=typeof n=="function"?n.toString():n;t[e]&&(clearTimeout(t[e].timer),delete t[e])}function a(n){return t[n]}function u(n){return()=>{c(n)}}async function s(n){if(t[n]){t[n].finishing=!0
|
|
1
|
+
const t={};function c(n){const e=typeof n=="function"?n.toString():n;t[e]&&(clearTimeout(t[e].timer),delete t[e])}function a(n){return t[n]}function u(n){return()=>{c(n)}}async function s(n){if(t[n]){t[n].finishing=!0;const e=t[n].trailing;await t[n].callback(),c(n),e&&e[0](...e.slice(1))}}function o(n,e,i){if(t[i]?.finishing)return u(i);const r=setTimeout(()=>{s(i)},n);return t[i]={timer:r,callback:e},u(i)}function g(n,e,{key:i=e.toString(),replace:r}={}){return t[i]?(r&&(t[i].callback=e),u(i)):o(n,e,i)}function k(n,e,{key:i=e.toString(),leading:r}={}){if(t[i]&&!t[i].finishing)c(i);else if(r)return f(n,e,{key:i});return o(n,e,i)}function f(n,e,{key:i=e.toString(),trailing:r}={}){if(t[i])return r&&(t[i].trailing=[f,n,e,{key:i}]),u(i);const l=e();return o(n,()=>l,i)}export{c as clear,g as countdown,k as debounce,a as getInstance,f as throttle};
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kontroll",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
5
|
-
"packageManager": "pnpm@10.8.0",
|
|
4
|
+
"version": "1.1.2",
|
|
6
5
|
"description": "kontroll (\"control\") is a tiny, dead-simple package for function behavior controls like debounce, countdown, throttle (limit).",
|
|
7
6
|
"author": "NamesMT <dangquoctrung123@gmail.com>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -41,22 +40,6 @@
|
|
|
41
40
|
"engines": {
|
|
42
41
|
"node": ">=18.0.0"
|
|
43
42
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"start": "NODE_ENV=dev tsx src/index.ts",
|
|
46
|
-
"watch": "NODE_ENV=dev tsx watch src/index.ts",
|
|
47
|
-
"stub": "unbuild --stub",
|
|
48
|
-
"dev": "pnpm run watch",
|
|
49
|
-
"play": "pnpm run stub && pnpm run --filter playground dev",
|
|
50
|
-
"play:useBuild": "pnpm run build && pnpm run --filter playground dev",
|
|
51
|
-
"lint": "eslint .",
|
|
52
|
-
"test": "vitest",
|
|
53
|
-
"test:types": "tsc --noEmit --skipLibCheck",
|
|
54
|
-
"check": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
55
|
-
"build": "unbuild",
|
|
56
|
-
"release": "pnpm dlx changelogen@latest --release --push --publish",
|
|
57
|
-
"prepare": "simple-git-hooks",
|
|
58
|
-
"prepublishOnly": "pnpm run build"
|
|
59
|
-
},
|
|
60
43
|
"devDependencies": {
|
|
61
44
|
"@antfu/eslint-config": "^4.12.0",
|
|
62
45
|
"@types/node": "^22.14.0",
|
|
@@ -69,19 +52,24 @@
|
|
|
69
52
|
"unbuild": "^3.5.0",
|
|
70
53
|
"vitest": "^3.1.1"
|
|
71
54
|
},
|
|
72
|
-
"pnpm": {
|
|
73
|
-
"overrides": {
|
|
74
|
-
"is-core-module": "npm:@nolyfill/is-core-module@^1"
|
|
75
|
-
},
|
|
76
|
-
"onlyBuiltDependencies": [
|
|
77
|
-
"esbuild",
|
|
78
|
-
"simple-git-hooks"
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
55
|
"simple-git-hooks": {
|
|
82
56
|
"pre-commit": "pnpm lint-staged"
|
|
83
57
|
},
|
|
84
58
|
"lint-staged": {
|
|
85
59
|
"*": "eslint"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"start": "NODE_ENV=dev tsx src/index.ts",
|
|
63
|
+
"watch": "NODE_ENV=dev tsx watch src/index.ts",
|
|
64
|
+
"stub": "unbuild --stub",
|
|
65
|
+
"dev": "pnpm run watch",
|
|
66
|
+
"play": "pnpm run stub && pnpm run --filter playground dev",
|
|
67
|
+
"play:useBuild": "pnpm run build && pnpm run --filter playground dev",
|
|
68
|
+
"lint": "eslint .",
|
|
69
|
+
"test": "vitest",
|
|
70
|
+
"test:types": "tsc --noEmit --skipLibCheck",
|
|
71
|
+
"check": "pnpm lint && pnpm test:types && vitest run --coverage",
|
|
72
|
+
"build": "unbuild",
|
|
73
|
+
"release": "pnpm dlx changelogen@latest --release --push --publish"
|
|
86
74
|
}
|
|
87
|
-
}
|
|
75
|
+
}
|