3 category: JavaScript libraries
7 [101](https://www.npmjs.com/package/101) is a JavaScript library for dealing with immutable data in a functional manner.
13 const isObject = require('101/isObject')
14 isObject({}) // → true
17 Every function is exposed as a module.
19 See: [101](https://github.com/tjmehta/101)
32 instanceOf(obj, 'string')
48 obj = put(obj, 'user.name', 'John')
49 // → { user: { name: 'John' } }
55 pluck(name, 'user.name')
62 obj = del(obj, 'user')
69 pluck(state, 'user.profile.name')
73 pick(state, ['user', 'ui'])
77 `pluck` returns values, `pick` returns subsets of objects.
80 [pluck](https://github.com/tjmehta/101#pluck),
81 [pick](https://github.com/tjmehta/101#pick)
86 put(state, 'user.profile.name', 'john')
90 [put](https://github.com/tjmehta/101#put)
95 del(state, 'user.profile')
96 omit(state, ['user', 'data'])
99 `omit` is like `del`, but supports multiple keys to be deleted.
102 [omit](https://github.com/tjmehta/101#omit),
103 [del](https://github.com/tjmehta/101#del)
108 hasKeypaths(state, ['user'])
109 hasKeypaths(state, { 'user.profile.name': 'john' })
113 [hasKeypaths](https://github.com/tjmehta/101#haskeypaths)
125 | `and(x, y)` | `x && y` |
126 | `or(x, y)` | `x || y` |
127 | `xor(x, y)` | `!(!x && !y) && !(x && y)` |
128 | `equals(x, y)` | `x === y` |
129 | `exists(x)` | `!!x` |
132 Useful for function composition.
135 [and](https://github.com/tjmehta/101#and),
136 [equals](https://github.com/tjmehta/101#equals),
137 [exists](https://github.com/tjmehta/101#exists)
142 compose(f, g) // x => f(g(x))
143 curry(f) // x => y => f(x, y)
144 flip(f) // f(x, y) --> f(y, x)
148 [compose](https://github.com/tjmehta/101#compose),
149 [curry](https://github.com/tjmehta/101#curry),
150 [flip](https://github.com/tjmehta/101#flip)
155 passAll(f, g) // x => f(x) && g(x)
156 passAny(f, g) // x => f(x) || g(x)
160 [passAll](https://github.com/tjmehta/101#passall),
161 [passAny](https://github.com/tjmehta/101#passany)
166 converge(and, [pluck('a'), pluck('b')])(x)
170 // → and(pluck(x, 'a'), pluck(x, 'b'))
174 [converge](https://github.com/tjmehta/101#converge)
181 find(list, x => x.y === 2)
182 findIndex(list, x => ...)
183 includes(list, 'item')
188 find(list, hasProps('id'))
200 ### Function composition
203 isFloat = passAll(isNumber, compose(isInteger, not))
204 // n => isNumber(n) && not(isInteger(n))
208 function doStuff (object, options) { ... }
210 doStuffForce = curry(flip(doStuff))({ force: true })
215 - <https://github.com/tjmehta/101>