UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

21 lines (17 loc) 430 B
import { equals } from './equals.js' export function contains(target, toCompare){ if (arguments.length === 1){ return _toCompare => contains(target, _toCompare) } let willReturn = true Object.keys(target).forEach(prop => { if (!willReturn) return if ( toCompare[ prop ] === undefined || !equals(target[ prop ], toCompare[ prop ]) ){ willReturn = false } }) return willReturn }