1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var tslib_1 = require("tslib");
|
4 | var is_object_1 = (0, tslib_1.__importDefault)(require("./is-object"));
|
5 | var is_string_1 = (0, tslib_1.__importDefault)(require("./is-string"));
|
6 | var is_number_1 = (0, tslib_1.__importDefault)(require("./is-number"));
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | exports.default = (function (obj, path, value) {
|
14 | var o = obj;
|
15 | var keyArr = (0, is_string_1.default)(path) ? path.split('.') : path;
|
16 | keyArr.forEach(function (key, idx) {
|
17 |
|
18 | if (idx < keyArr.length - 1) {
|
19 | if (!(0, is_object_1.default)(o[key])) {
|
20 | o[key] = (0, is_number_1.default)(keyArr[idx + 1]) ? [] : {};
|
21 | }
|
22 | o = o[key];
|
23 | }
|
24 | else {
|
25 | o[key] = value;
|
26 | }
|
27 | });
|
28 | return obj;
|
29 | });
|
30 |
|
\ | No newline at end of file |