2.1.1 • Published 10 years ago

toggle-member v2.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
10 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

10 years ago

2.1.0

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago