1.0.2 • Published 7 years ago

@lukeboyle/array-item-toggle v1.0.2

Weekly downloads
5
License
MIT
Repository
-
Last release
7 years ago

Array Item Toggle

Build Status Coverage Status

A helper function to check if an item is:

  • in an array -> remove it from the array,
  • not in the array -> add it to the array

Usage

import toggle from 'array-item-toggle';

toggle([1, 2, 3], 1)

// returns a new array = [2, 3];

toggle([2, 3], 1)

// returns a new array = [2, 3, 1];
1.0.2

7 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago