Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Latest commit

 

History

History
51 lines (40 loc) · 1.19 KB

index.md

File metadata and controls

51 lines (40 loc) · 1.19 KB

$contains projection

Checks if a structure contains an item at the position addressed by path

Signature

value (Any) - The value to search for

path (String/Array) - Path to the property to search in

subject (Object) - The object that contains the requested value

TYPE SIGNATURES

* -> String -> Object -> Boolean
(*, String) -> Object -> Boolean
(*, String, Object) -> Boolean
* -> Array -> Object -> Boolean
(*, Array) -> Object -> Boolean
(*, Array, Object) -> Boolean

EXAMPLE

const myObject = {
	rooms: {
		kitchen: {
			refrigerator: [
				'eggs',
				'beer',
				'milk'
			]
		}
	}
};

$contains('beer', 'rooms.kitchen.refrigerator', myObject); // returns true
$contains('wine', 'rooms.kitchen.refrigerator', myObject); // returns false

IMMUTABLE JS SUPPORT (DEPRECATED)

WARNING: Immutable JS support is deprecated. It will be removed entirely with the next major version of Plow JS (which will be 4.0.0). Until then, support for Immutable JS versions below (but not including) v4 - though discouraged - continues to work.

the following types are supported for values targeted by path:

Iterable.Indexed
Iterable.Keyed