Socket
Socket
Sign inDemoInstall

feint

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    feint

Make a given function do nothing at its first call


Version published
Weekly downloads
21
decreased by-61.11%
Maintainers
1
Install size
7.18 kB
Created
Weekly downloads
 

Readme

Source

feint

npm version Build Status codecov

Make a given Function do nothing at its first call

import feint from 'feint';

const fn = feint(() => 1);
fn(); //=> undefined
fn(); //=> 1
fn(); //=> 1

Installation

Use [npm]https://docs.npmjs.com/about-npm/).

npm install feint

API

import feint from 'feint';

feint(fn)

fn: Function
Return: Function

It returns a new Function that does nothing when it's called for the first time. From the second time on, the function performs normally.

import {existsSync, mkdirSync} from 'fs';
import feint from 'feint';

const feintMkdir = feint(mkdirSync);

feintMkdir('foo');
existsSync('foo'); //=> false

feintMkdir('foo');
existsSync('foo'); //=> true

License

ISC License © 2018 - 2019 Watanabe Shinnosuke

Keywords

FAQs

Last updated on 26 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc