1 | 'use strict';
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.filterUndefinedValue = filterUndefinedValue;
|
5 | exports.stripObject = stripObject;
|
6 |
|
7 | var _util = require('../util');
|
8 |
|
9 | var isPlainObject = _util.obj.isPlainObject;
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function filterUndefinedValue(object) {
|
18 | if (!isPlainObject(object)) {
|
19 | return object;
|
20 | }
|
21 |
|
22 | var obj = {};
|
23 |
|
24 | Object.keys(object).forEach(function (key) {
|
25 | var value = object[key];
|
26 |
|
27 | if (value !== undefined) {
|
28 | obj[key] = value;
|
29 | }
|
30 | });
|
31 |
|
32 | return obj;
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | function stripObject(obj, subObj) {
|
42 | var newObject = {};
|
43 |
|
44 | Object.keys(obj).forEach(function (key) {
|
45 | if (!(key in subObj)) {
|
46 | newObject[key] = obj[key];
|
47 | }
|
48 | });
|
49 | return newObject;
|
50 | } |
\ | No newline at end of file |