noop-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

noop-ts

A very simple "do nothing" JavaScript function, compatible with TypeScript. Since the noop accepts any arguments (and does nothing in return), it can be used as a replacement of any function passed as a parameter to another function or a property of a web/React/Angular/(...) component.

That can be particularly useful for unit tests, for example to test a React component:

import noop from 'noop-ts';

describe('MyComponent', () => {
  it('does what I want it to do', () => {
    const component = shallow(<MyComponent onChange={noop} />);
    expect(component).toMatchSnapshot();
  });
});

Installation

npm

npm install noop-ts --save-dev

yarn

yarn add noop-ts --dev

Readme

Keywords

none

Package Sidebar

Install

npm i noop-ts

Weekly Downloads

1,199

Version

1.0.7

License

ISC

Unpacked Size

1.97 kB

Total Files

7

Last publish

Collaborators

  • maxime.julian