Comparing version 0.0.731 to 0.0.732
export function singleton<f extends (...args: unknown[]) => unknown>(f: f): f { | ||
let result: [unknown]; | ||
let result: unknown; | ||
assert(result === noop()); | ||
return function (this: unknown, ...as) { | ||
if (result) return result[0]; | ||
result = [f.call(this, ...as)]; | ||
return result[0]; | ||
if (f === noop) return result; | ||
result = f.call(this, ...as); | ||
f = noop as f; | ||
return result; | ||
} as f; | ||
@@ -8,0 +10,0 @@ } |
{ | ||
"name": "spica", | ||
"version": "0.0.731", | ||
"version": "0.0.732", | ||
"description": "Supervisor, Coroutine, Channel, select, AtomicPromise, Cancellation, Cache, List, Queue, Stack, and some utils.", | ||
@@ -60,3 +60,3 @@ "private": false, | ||
"@types/yallist": "4.0.1", | ||
"@typescript-eslint/parser": "^5.59.8", | ||
"@typescript-eslint/parser": "^5.59.9", | ||
"babel-loader": "^9.1.2", | ||
@@ -69,3 +69,3 @@ "babel-plugin-unassert": "^3.2.0", | ||
"eslint-webpack-plugin": "^4.0.1", | ||
"glob": "^10.2.6", | ||
"glob": "^10.2.7", | ||
"karma": "^6.4.2", | ||
@@ -82,3 +82,3 @@ "karma-chrome-launcher": "^3.2.0", | ||
"typescript": "5.1.3", | ||
"webpack": "^5.85.0", | ||
"webpack": "^5.85.1", | ||
"webpack-cli": "^5.1.3", | ||
@@ -85,0 +85,0 @@ "webpack-merge": "^5.9.0", |
export function singleton<f extends (...args: unknown[]) => unknown>(f: f): f { | ||
let result: [unknown]; | ||
let result: unknown; | ||
assert(result === noop()); | ||
return function (this: unknown, ...as) { | ||
if (result) return result[0]; | ||
result = [f.call(this, ...as)]; | ||
return result[0]; | ||
if (f === noop) return result; | ||
result = f.call(this, ...as); | ||
f = noop as f; | ||
return result; | ||
} as f; | ||
@@ -8,0 +10,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1156911
32326