| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 'use strict';
- exports.__esModule = true;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
- exports.stringify = stringify;
- exports.isDefined = isDefined;
- exports.isUndefined = isUndefined;
- exports.isEmpty = isEmpty;
- exports.isRegExp = isRegExp;
- /**
- * Converts any value to string.
- *
- * @param {*} value
- * @returns {String}
- */
- function stringify(value) {
- var result = void 0;
- switch (typeof value === 'undefined' ? 'undefined' : _typeof(value)) {
- case 'string':
- case 'number':
- result = '' + value;
- break;
- case 'object':
- result = value === null ? '' : value.toString();
- break;
- case 'undefined':
- result = '';
- break;
- default:
- result = value.toString();
- break;
- }
- return result;
- }
- /**
- * Checks if given variable is defined.
- *
- * @param {*} variable Variable to check.
- * @returns {Boolean}
- */
- function isDefined(variable) {
- return typeof variable !== 'undefined';
- }
- /**
- * Checks if given variable is undefined.
- *
- * @param {*} variable Variable to check.
- * @returns {Boolean}
- */
- function isUndefined(variable) {
- return typeof variable === 'undefined';
- }
- /**
- * Check if given variable is null, empty string or undefined.
- *
- * @param {*} variable Variable to check.
- * @returns {Boolean}
- */
- function isEmpty(variable) {
- return variable === null || variable === '' || isUndefined(variable);
- }
- /**
- * Check if given variable is a regular expression.
- *
- * @param {*} variable Variable to check.
- * @returns {Boolean}
- */
- function isRegExp(variable) {
- return Object.prototype.toString.call(variable) === '[object RegExp]';
- }
|