Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

once

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

once - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

4

once.js

@@ -14,5 +14,5 @@ module.exports = once

var f = function () {
if (f.called) return
if (f.called) return f.value
f.called = true
return fn.apply(this, arguments)
return f.value = fn.apply(this, arguments)
}

@@ -19,0 +19,0 @@ f.called = false

{
"name": "once",
"version": "1.2.0",
"version": "1.3.0",
"description": "Run a function exactly one time",

@@ -5,0 +5,0 @@ "main": "once.js",

@@ -35,3 +35,6 @@ # once

To check whether you function has been called, use `fn.called`:
To check whether you function has been called, use `fn.called`. Once the
function is called for the first time the return value of the original
function is saved in `fn.value` and subsequent calls will continue to
return this value.

@@ -49,2 +52,2 @@ ```javascript

}
```
```

@@ -16,3 +16,3 @@ var test = require('tap').test

t.ok(foo.called)
t.same(g, i === 0 ? 3 : undefined)
t.same(g, 3)
t.same(f, 1)

@@ -19,0 +19,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc