JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q67550F
  • License CC0-1.0

Make a given function do nothing at its first call

Package Exports

  • feint

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (feint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

feint

NPM version Build Status Coverage Status

Make a given function do nothing at its first call

const feint = require('feint');

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

Installation

Use npm.

npm install feint

API

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.

const {existsSync, mkdirSync} = require('fs');
const feint = require('feint');

const feintMkdir = feint(mkdirSync);

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

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

License

Creative Commons Zero v1.0 Universal