@cicada/render
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -25,7 +25,18 @@ 'use strict'; | ||
function isExist(variable) { | ||
return variable !== undefined && variable !== null; | ||
} | ||
exports.default = (0, _extends3.default)({}, _exist2.default, { | ||
get: function get(obj, path, defaultValue) { | ||
return path === '' || path === undefined ? obj : _exist2.default.get(obj, path, defaultValue); | ||
get: function get(obj) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var defaultValue = arguments[2]; | ||
/* eslint-disable no-nested-ternary*/ | ||
return path === '' ? isExist(obj) ? obj : defaultValue : _exist2.default.get(obj, path, defaultValue); | ||
}, | ||
ensure: function ensure(obj, path, value) { | ||
ensure: function ensure(obj) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var value = arguments[2]; | ||
if (_exist2.default.detect(obj, path) !== true) { | ||
@@ -35,3 +46,6 @@ _exist2.default.set(obj, path, value, true); | ||
}, | ||
assign: function assign(obj, path, newValue) { | ||
assign: function assign(obj) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var newValue = arguments[2]; | ||
var origin = _exist2.default.get(obj, path); | ||
@@ -38,0 +52,0 @@ if (origin === undefined) { |
{ | ||
"name": "@cicada/render", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
339096
8156