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

function-double

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-double

Stand-in for a function

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
decreased by-16.99%
Maintainers
1
Weekly downloads
 
Created
Source

function-double

CircleCI status Greenkeeper badge

Stands for the real function passing though all the descriptions and properties of the source function.

It is literally impossible to distinguish the real function, and it's double.

import functionDouble from 'function-double';

const secretFunction = (a,b) => a+b;
secretFunction.propTypes = "this is not React";
const wrapperFunction = (...args) => secretFunction(...args) + 4;

secretFunction.length === 2
wrapperFunction.length === 0
wrapperFunction.propTypes === undefined

const result = functionDouble(wrapperFunction, secretFunction);

wrapperFunction.propTypes === "this is not React";
wrapperFunction.length === 2;


result === wrapperFunction;/ / But not in IE11 :)

API

functionDouble(targetFunction, sourceFunction, [options]) - moves all the stuff from sourceFunction to target.

  • options.toString = (sourceFunction) => string. Override method for toString.
  • options.name = (sourceFunction) => string. Override method for name.

License

MIT

Keywords

FAQs

Package last updated on 21 Jul 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc