nullable-util 
utility functions with Nullable

usage example
const util = require('nullable-util')
const collection = [1, 2, 3, 4, 5]
util.first(collection)
util.first(collection, x => x > 3)
util.last(collection)
util.last(collection, x => x < 3)
const users = {
1: {
name: 'A'
admin: false
},
2: {
name: 'B',
admin: true
}
}
util.first(users)
util.first(users, user => user.admin)
first
and last
operate on Arrays and Array-likes (NodeList, etc.), plain Objects,
ES6 collections (Set and Map, but not WeakSet or WeakMap which are not iterable).
first
can also operate on generators, but not last
since generators may be infinite.
See test suite for more examples.
installation
$ npm install nullable-util
running the tests
From package root:
$ npm install
$ npm test
license
ISC. (c) MMXVII jsdnxx. See LICENSE.md