2.1.1 • Published 8 years ago

toggle-member v2.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

toggle-member

toggleMember(set, member) returns a new set with/without member.

const toggleMember = require('toggle-member')
const setWithFoo = new Set(['foo', 'bar'])
toggleMember(setWithFoo, 'foo') // Set(['bar'])
toggleMember(setWithFoo, 'baz') // Set(['foo', 'bar', 'baz'])

// or use with chill-patch to safely monkey patch Set
const chillPatch = require('chill-patch')
const toggle = chillPatch(Set, toggleMember)
setWithFoo[toggle]('foo') // Set(['bar'])

Requires ES2015 Set:

2.1.1

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago