main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 |
|
---|
5 | var equals =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./equals.js");
|
---|
8 |
|
---|
9 | var map =
|
---|
10 | /*#__PURE__*/
|
---|
11 | require("./map.js");
|
---|
12 |
|
---|
13 | var where =
|
---|
14 | /*#__PURE__*/
|
---|
15 | require("./where.js");
|
---|
16 | /**
|
---|
17 | * Takes a spec object and a test object; returns true if the test satisfies
|
---|
18 | * the spec, false otherwise. An object satisfies the spec if, for each of the
|
---|
19 | * spec's own properties, accessing that property of the object gives the same
|
---|
20 | * value (in [`R.equals`](#equals) terms) as accessing that property of the
|
---|
21 | * spec.
|
---|
22 | *
|
---|
23 | * `whereEq` is a specialization of [`where`](#where).
|
---|
24 | *
|
---|
25 | * @func
|
---|
26 | * @memberOf R
|
---|
27 | * @since v0.14.0
|
---|
28 | * @category Object
|
---|
29 | * @sig {String: *} -> {String: *} -> Boolean
|
---|
30 | * @param {Object} spec
|
---|
31 | * @param {Object} testObj
|
---|
32 | * @return {Boolean}
|
---|
33 | * @see R.propEq, R.where
|
---|
34 | * @example
|
---|
35 | *
|
---|
36 | * // pred :: Object -> Boolean
|
---|
37 | * const pred = R.whereEq({a: 1, b: 2});
|
---|
38 | *
|
---|
39 | * pred({a: 1}); //=> false
|
---|
40 | * pred({a: 1, b: 2}); //=> true
|
---|
41 | * pred({a: 1, b: 2, c: 3}); //=> true
|
---|
42 | * pred({a: 1, b: 1}); //=> false
|
---|
43 | */
|
---|
44 |
|
---|
45 |
|
---|
46 | var whereEq =
|
---|
47 | /*#__PURE__*/
|
---|
48 | _curry2(function whereEq(spec, testObj) {
|
---|
49 | return where(map(equals, spec), testObj);
|
---|
50 | });
|
---|
51 |
|
---|
52 | module.exports = whereEq; |
---|
Note:
See
TracBrowser
for help on using the repository browser.