Gathering detailed insights and metrics for one-time-execution-method
Gathering detailed insights and metrics for one-time-execution-method
Gathering detailed insights and metrics for one-time-execution-method
Gathering detailed insights and metrics for one-time-execution-method
define a method that will be executed only once
npm install one-time-execution-method
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
0BSD License
1 Stars
1,472 Commits
2 Watchers
2 Branches
1 Contributors
Updated on Jul 05, 2025
Latest Version
3.1.3
Package Id
one-time-execution-method@3.1.3
Unpacked Size
8.92 kB
Size
3.09 kB
File Count
5
NPM Version
10.9.2
Node Version
22.15.0
Published on
May 06, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
Define methods that will be executed only once.
For async functions the resulting Promise of the 1st. invocation will be preserved and always delivered in the future.
1import { replaceWithOneTimeExecutionMethod } from "one-time-execution-method"; 2 3class MyClass { 4 constructor() { 5 this.executions = 0; 6 } 7 8 initialize() { 9 this.executions++; 10 return new Promise(resolve => setTimeout(resolve, 1000)); 11 } 12} 13 14// replace initialize() method of MyClass to be executed only once 15replaceWithOneTimeExecutionMethod(MyClass.prototype, "initialize"); 16 17async doit() { 18 const object = new MyClass(); 19 20 // start several initializations in parallel 21 Promise.all([object.initialize(), object.initialize(), object.initialize()]); 22 23 await object.initialize(); 24 25 // even after several parallel executions only one run is done 26 console.log(this.executions); // -> 1 27} 28 29doit();
Replace a given method with one that will only be executed once. For async functions the resulting Promise of the 1st. invocation will be preserved and always delivered in the future.
1class MyClass { 2 async initialize() { 3 // code here will be executed only once 4 } 5} 6replaceWithOneTimeExecutionMethod(MyClass.prototype, "initialize"); 7 8const object = new MyClass(); 9object.initialize(); // body will/can be executed only once 10object.initialize(); // 2nd. call immediatly returns
Object symbol slot holding the state of the method.
With npm do:
1npm install one-time-execution-method
BSD-2-Clause
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More