@reverse/callback
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@reverse/callback

Little callbacks you can use to work faster.

I wrote these since I was tired of repeating some of the same code, so I threw these little things in a helper function package.

You can install with nodejs and npm

npm i @reverse/callback

Table of Contents**

identity

Returns the passed argument.

export const identity = (x) => x;

Calls the passed argument.

export const call = (x) => x();

Useful for calling everything in an array: functionArray.forEach(call);

propEquals [generator]

Creates a callback for if the passed argument's property equals a certain value.

const propEquals = (prop, value) => (item) => item[prop] === value;

Useful for finding an item in an array using .find() array.find(propEquals('name', 'dave'));

Readme

Keywords

Package Sidebar

Install

npm i @reverse/callback

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

3.45 kB

Total Files

6

Last publish

Collaborators

  • davecaruso
  • hparcells
  • imdaveead