Created
June 18, 2019 23:05
-
-
Save swashcap/1f14df7facfb46f39e46889b09334f7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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