aboutsummaryrefslogtreecommitdiff
path: root/node_modules/onetime
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/onetime')
-rw-r--r--node_modules/onetime/index.js39
-rw-r--r--node_modules/onetime/license21
-rw-r--r--node_modules/onetime/package.json40
-rw-r--r--node_modules/onetime/readme.md65
4 files changed, 0 insertions, 165 deletions
diff --git a/node_modules/onetime/index.js b/node_modules/onetime/index.js
deleted file mode 100644
index 0d76476b0..000000000
--- a/node_modules/onetime/index.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-const mimicFn = require('mimic-fn');
-
-module.exports = (fn, opts) => {
- // TODO: Remove this in v3
- if (opts === true) {
- throw new TypeError('The second argument is now an options object');
- }
-
- if (typeof fn !== 'function') {
- throw new TypeError('Expected a function');
- }
-
- opts = opts || {};
-
- let ret;
- let called = false;
- const fnName = fn.displayName || fn.name || '<anonymous>';
-
- const onetime = function () {
- if (called) {
- if (opts.throw === true) {
- throw new Error(`Function \`${fnName}\` can only be called once`);
- }
-
- return ret;
- }
-
- called = true;
- ret = fn.apply(this, arguments);
- fn = null;
-
- return ret;
- };
-
- mimicFn(onetime, fn);
-
- return onetime;
-};
diff --git a/node_modules/onetime/license b/node_modules/onetime/license
deleted file mode 100644
index 654d0bfe9..000000000
--- a/node_modules/onetime/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/node_modules/onetime/package.json b/node_modules/onetime/package.json
deleted file mode 100644
index 73223ff96..000000000
--- a/node_modules/onetime/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "onetime",
- "version": "2.0.1",
- "description": "Ensure a function is only called once",
- "license": "MIT",
- "repository": "sindresorhus/onetime",
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
- },
- "engines": {
- "node": ">=4"
- },
- "scripts": {
- "test": "xo && ava"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "once",
- "function",
- "one",
- "onetime",
- "func",
- "fn",
- "single",
- "call",
- "called",
- "prevent"
- ],
- "dependencies": {
- "mimic-fn": "^1.0.0"
- },
- "devDependencies": {
- "ava": "*",
- "xo": "*"
- }
-}
diff --git a/node_modules/onetime/readme.md b/node_modules/onetime/readme.md
deleted file mode 100644
index 95eb3b7c9..000000000
--- a/node_modules/onetime/readme.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# onetime [![Build Status](https://travis-ci.org/sindresorhus/onetime.svg?branch=master)](https://travis-ci.org/sindresorhus/onetime)
-
-> Ensure a function is only called once
-
-When called multiple times it will return the return value from the first call.
-
-*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty extending `Function.prototype`.*
-
-
-## Install
-
-```
-$ npm install --save onetime
-```
-
-
-## Usage
-
-```js
-let i = 0;
-
-const foo = onetime(() => i++);
-
-foo(); //=> 0
-foo(); //=> 0
-foo(); //=> 0
-```
-
-```js
-const foo = onetime(() => {}, {throw: true});
-
-foo();
-
-foo();
-//=> Error: Function `foo` can only be called once
-```
-
-
-## API
-
-### onetime(fn, [options])
-
-Returns a function that only calls `fn` once.
-
-#### fn
-
-Type: `Function`
-
-Function that should only be called once.
-
-#### options
-
-Type: `Object`
-
-##### throw
-
-Type: `boolean`<br>
-Default: `false`
-
-Throw an error when called more than once.
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)