summaryrefslogtreecommitdiffstats
path: root/pkg/runner/testdata/actions/node20/node_modules/once/once.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2025-01-24 09:00:09 +0100
committerDaniel Baumann <daniel@debian.org>2025-01-24 09:00:09 +0100
commit4bf4dabd48aa70da3699b9a023f22689645d24f4 (patch)
treeed8175444649e71c0ed0e5f1d30101786ca2473e /pkg/runner/testdata/actions/node20/node_modules/once/once.js
parentInitial commit. (diff)
downloadforgejo-act-debian.tar.xz
forgejo-act-debian.zip
Adding upstream version 1.24.0.HEADupstream/1.24.0upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'pkg/runner/testdata/actions/node20/node_modules/once/once.js')
-rw-r--r--pkg/runner/testdata/actions/node20/node_modules/once/once.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkg/runner/testdata/actions/node20/node_modules/once/once.js b/pkg/runner/testdata/actions/node20/node_modules/once/once.js
new file mode 100644
index 0000000..2354067
--- /dev/null
+++ b/pkg/runner/testdata/actions/node20/node_modules/once/once.js
@@ -0,0 +1,42 @@
+var wrappy = require('wrappy')
+module.exports = wrappy(once)
+module.exports.strict = wrappy(onceStrict)
+
+once.proto = once(function () {
+ Object.defineProperty(Function.prototype, 'once', {
+ value: function () {
+ return once(this)
+ },
+ configurable: true
+ })
+
+ Object.defineProperty(Function.prototype, 'onceStrict', {
+ value: function () {
+ return onceStrict(this)
+ },
+ configurable: true
+ })
+})
+
+function once (fn) {
+ var f = function () {
+ if (f.called) return f.value
+ f.called = true
+ return f.value = fn.apply(this, arguments)
+ }
+ f.called = false
+ return f
+}
+
+function onceStrict (fn) {
+ var f = function () {
+ if (f.called)
+ throw new Error(f.onceError)
+ f.called = true
+ return f.value = fn.apply(this, arguments)
+ }
+ var name = fn.name || 'Function wrapped with `once`'
+ f.onceError = name + " shouldn't be called more than once"
+ f.called = false
+ return f
+}