bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
107 lines (94 loc) • 4.59 kB
JavaScript
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { isObject } from './inspect'; // --- Static ---
export var assign = function assign() {
return Object.assign.apply(Object, arguments);
};
export var create = function create(proto, optionalProps) {
return Object.create(proto, optionalProps);
};
export var defineProperties = function defineProperties(obj, props) {
return Object.defineProperties(obj, props);
};
export var defineProperty = function defineProperty(obj, prop, descriptor) {
return Object.defineProperty(obj, prop, descriptor);
};
export var freeze = function freeze(obj) {
return Object.freeze(obj);
};
export var getOwnPropertyNames = function getOwnPropertyNames(obj) {
return Object.getOwnPropertyNames(obj);
};
export var getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
return Object.getOwnPropertyDescriptor(obj, prop);
};
export var getOwnPropertySymbols = function getOwnPropertySymbols(obj) {
return Object.getOwnPropertySymbols(obj);
};
export var getPrototypeOf = function getPrototypeOf(obj) {
return Object.getPrototypeOf(obj);
};
export var is = function is(value1, value2) {
return Object.is(value1, value2);
};
export var isFrozen = function isFrozen(obj) {
return Object.isFrozen(obj);
};
export var keys = function keys(obj) {
return Object.keys(obj);
}; // --- "Instance" ---
export var hasOwnProperty = function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
export var toString = function toString(obj) {
return Object.prototype.toString.call(obj);
}; // --- Utilities ---
// Shallow copy an object
export var clone = function clone(obj) {
return _objectSpread({}, obj);
}; // Return a shallow copy of object with the specified properties only
// See: https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc
export var pick = function pick(obj, props) {
return keys(obj).filter(function (key) {
return props.indexOf(key) !== -1;
}).reduce(function (result, key) {
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, obj[key]));
}, {});
}; // Return a shallow copy of object with the specified properties omitted
// See: https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc
export var omit = function omit(obj, props) {
return keys(obj).filter(function (key) {
return props.indexOf(key) === -1;
}).reduce(function (result, key) {
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, obj[key]));
}, {});
}; // Merges two object deeply together
// See: https://gist.github.com/Salakar/1d7137de9cb8b704e48a
export var mergeDeep = function mergeDeep(target, source) {
if (isObject(target) && isObject(source)) {
keys(source).forEach(function (key) {
if (isObject(source[key])) {
if (!target[key] || !isObject(target[key])) {
target[key] = source[key];
}
mergeDeep(target[key], source[key]);
} else {
assign(target, _defineProperty({}, key, source[key]));
}
});
}
return target;
}; // Returns a shallow copy of the object with keys in sorted order
export var sortKeys = function sortKeys(obj) {
return keys(obj).sort().reduce(function (result, key) {
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, obj[key]));
}, {});
}; // Convenience method to create a read-only descriptor
export var readonlyDescriptor = function readonlyDescriptor() {
return {
enumerable: true,
configurable: false,
writable: false
};
};