Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
574 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /**
|
---|
| 2 | * A specialized version of `matchesProperty` for source values suitable
|
---|
| 3 | * for strict equality comparisons, i.e. `===`.
|
---|
| 4 | *
|
---|
| 5 | * @private
|
---|
| 6 | * @param {string} key The key of the property to get.
|
---|
| 7 | * @param {*} srcValue The value to match.
|
---|
| 8 | * @returns {Function} Returns the new spec function.
|
---|
| 9 | */
|
---|
| 10 | function matchesStrictComparable(key, srcValue) {
|
---|
| 11 | return function(object) {
|
---|
| 12 | if (object == null) {
|
---|
| 13 | return false;
|
---|
| 14 | }
|
---|
| 15 | return object[key] === srcValue &&
|
---|
| 16 | (srcValue !== undefined || (key in Object(object)));
|
---|
| 17 | };
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | module.exports = matchesStrictComparable;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.