1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- (function (factory) {
- if (typeof module === "object" && typeof module.exports === "object") {
- var v = factory(require, exports);
- if (v !== undefined) module.exports = v;
- }
- else if (typeof define === "function" && define.amd) {
- define(["require", "exports"], factory);
- }
- })(function (require, exports) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
- function equals(one, other) {
- if (one === other) {
- return true;
- }
- if (one === null || one === undefined || other === null || other === undefined) {
- return false;
- }
- if (typeof one !== typeof other) {
- return false;
- }
- if (typeof one !== 'object') {
- return false;
- }
- if ((Array.isArray(one)) !== (Array.isArray(other))) {
- return false;
- }
- var i, key;
- if (Array.isArray(one)) {
- if (one.length !== other.length) {
- return false;
- }
- for (i = 0; i < one.length; i++) {
- if (!equals(one[i], other[i])) {
- return false;
- }
- }
- }
- else {
- var oneKeys = [];
- for (key in one) {
- oneKeys.push(key);
- }
- oneKeys.sort();
- var otherKeys = [];
- for (key in other) {
- otherKeys.push(key);
- }
- otherKeys.sort();
- if (!equals(oneKeys, otherKeys)) {
- return false;
- }
- for (i = 0; i < oneKeys.length; i++) {
- if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
- return false;
- }
- }
- }
- return true;
- }
- exports.equals = equals;
- function isNumber(val) {
- return typeof val === 'number';
- }
- exports.isNumber = isNumber;
- function isDefined(val) {
- return typeof val !== 'undefined';
- }
- exports.isDefined = isDefined;
- function isBoolean(val) {
- return typeof val === 'boolean';
- }
- exports.isBoolean = isBoolean;
- function isString(val) {
- return typeof val === 'string';
- }
- exports.isString = isString;
- });
|