office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
51 lines (49 loc) • 1.5 kB
JavaScript
// Initialize global window id.
var CURRENT_ID_PROPERTY = '__currentId__';
var _global = window || process;
if (_global[CURRENT_ID_PROPERTY] === undefined) {
_global[CURRENT_ID_PROPERTY] = 0;
}
function checkProperties(a, b) {
for (var propName in a) {
if (a.hasOwnProperty(propName)) {
if (!b.hasOwnProperty(propName) || (b[propName] !== a[propName])) {
return false;
}
}
}
return true;
}
// Compare a to b and b to a
function shallowCompare(a, b) {
return checkProperties(a, b) && checkProperties(b, a);
}
exports.shallowCompare = shallowCompare;
// Assign function.
function assign(target) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
target = target || {};
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
var sourceObject = args_1[_a];
if (sourceObject) {
for (var propName in sourceObject) {
if (sourceObject.hasOwnProperty(propName)) {
target[propName] = sourceObject[propName];
}
}
}
}
return target;
}
exports.assign = assign;
/** Generates a unique id in the global scope (this spans across duplicate copies of the same library.) */
function getId(prefix) {
var index = _global[CURRENT_ID_PROPERTY]++;
return (prefix || '') + index;
}
exports.getId = getId;
//# sourceMappingURL=object.js.map
;