|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
700 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | function conformsTo(target, source) {
|
|---|
| 6 | if (source == null) {
|
|---|
| 7 | return true;
|
|---|
| 8 | }
|
|---|
| 9 | if (target == null) {
|
|---|
| 10 | return Object.keys(source).length === 0;
|
|---|
| 11 | }
|
|---|
| 12 | const keys = Object.keys(source);
|
|---|
| 13 | for (let i = 0; i < keys.length; i++) {
|
|---|
| 14 | const key = keys[i];
|
|---|
| 15 | const predicate = source[key];
|
|---|
| 16 | const value = target[key];
|
|---|
| 17 | if (value === undefined && !(key in target)) {
|
|---|
| 18 | return false;
|
|---|
| 19 | }
|
|---|
| 20 | if (typeof predicate === 'function' && !predicate(value)) {
|
|---|
| 21 | return false;
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | return true;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | exports.conformsTo = conformsTo;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.