53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var stdin_exports = {};
|
|
__export(stdin_exports, {
|
|
extend: () => extend,
|
|
get: () => get,
|
|
inBrowser: () => inBrowser,
|
|
isSameValue: () => isSameValue,
|
|
noop: () => noop,
|
|
pick: () => pick,
|
|
toArray: () => toArray
|
|
});
|
|
module.exports = __toCommonJS(stdin_exports);
|
|
var import_validate = require("./validate");
|
|
function noop() {
|
|
}
|
|
const extend = Object.assign;
|
|
const inBrowser = typeof window !== "undefined";
|
|
function get(object, path) {
|
|
const keys = path.split(".");
|
|
let result = object;
|
|
keys.forEach((key) => {
|
|
var _a;
|
|
result = (0, import_validate.isObject)(result) ? (_a = result[key]) != null ? _a : "" : "";
|
|
});
|
|
return result;
|
|
}
|
|
function pick(obj, keys, ignoreUndefined) {
|
|
return keys.reduce((ret, key) => {
|
|
if (!ignoreUndefined || obj[key] !== void 0) {
|
|
ret[key] = obj[key];
|
|
}
|
|
return ret;
|
|
}, {});
|
|
}
|
|
const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
const toArray = (item) => Array.isArray(item) ? item : [item];
|