Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const assert = require('assert')
const get = require('lodash/fp/get')
const { createSelector } = require('reselect')
const list = get('list')
const getId = createSelector(
list,
get('id')
)
assert.equal(getId(), undefined)
assert.equal(getId({}), undefined)
assert.equal(getId({ list: '' }), undefined)
assert.equal(getId({ list: {} }), undefined)
assert.equal(getId({ list: { id: 'bananas' } }), 'bananas')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.