Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const cloneDeep = require('lodash.clonedeep')
const debug = require('debug')('hyperdiff')
const isString = require('lodash.isstring')
const pullAt = require('lodash.pullat')

const isPresent = (itemIndex) => itemIndex !== -1
Expand All @@ -11,7 +12,8 @@ function GET_INITIAL_STATE () {
}

function hasItemWithProps (collection, item, props) {
return props.every(prop => item[prop] === collection[prop])
const propsArray = isString(props) ? [props] : props
return propsArray.every(prop => item[prop] === collection[prop])
}

function indexOf (collection, item, props) {
Expand Down
Loading