ts-commons
Advanced tools
Comparing version 1.0.23 to 1.0.24
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ThreadUtils = exports.ArrayUtils = exports.HttpUtils = exports.RegexUtils = exports.DateUtils = exports.NumberUtils = exports.StringUtils = exports.ObjectUtils = void 0; | ||
var array_utils_1 = require("./utils/array.utils"); | ||
exports.ArrayUtils = array_utils_1.ArrayUtils; | ||
Object.defineProperty(exports, "ArrayUtils", { enumerable: true, get: function () { return array_utils_1.ArrayUtils; } }); | ||
var date_utils_1 = require("./utils/date.utils"); | ||
exports.DateUtils = date_utils_1.DateUtils; | ||
Object.defineProperty(exports, "DateUtils", { enumerable: true, get: function () { return date_utils_1.DateUtils; } }); | ||
var http_utils_1 = require("./utils/http.utils"); | ||
exports.HttpUtils = http_utils_1.HttpUtils; | ||
Object.defineProperty(exports, "HttpUtils", { enumerable: true, get: function () { return http_utils_1.HttpUtils; } }); | ||
var number_utils_1 = require("./utils/number.utils"); | ||
exports.NumberUtils = number_utils_1.NumberUtils; | ||
Object.defineProperty(exports, "NumberUtils", { enumerable: true, get: function () { return number_utils_1.NumberUtils; } }); | ||
var object_utils_1 = require("./utils/object.utils"); | ||
exports.ObjectUtils = object_utils_1.ObjectUtils; | ||
Object.defineProperty(exports, "ObjectUtils", { enumerable: true, get: function () { return object_utils_1.ObjectUtils; } }); | ||
var regex_utils_1 = require("./utils/regex.utils"); | ||
exports.RegexUtils = regex_utils_1.RegexUtils; | ||
Object.defineProperty(exports, "RegexUtils", { enumerable: true, get: function () { return regex_utils_1.RegexUtils; } }); | ||
var string_utils_1 = require("./utils/string.utils"); | ||
exports.StringUtils = string_utils_1.StringUtils; | ||
Object.defineProperty(exports, "StringUtils", { enumerable: true, get: function () { return string_utils_1.StringUtils; } }); | ||
var thread_utils_1 = require("./utils/thread.utils"); | ||
exports.ThreadUtils = thread_utils_1.ThreadUtils; | ||
Object.defineProperty(exports, "ThreadUtils", { enumerable: true, get: function () { return thread_utils_1.ThreadUtils; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ArrayUtils = void 0; | ||
var number_utils_1 = require("./number.utils"); | ||
@@ -4,0 +5,0 @@ var object_utils_1 = require("./object.utils"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DateUtils = void 0; | ||
var object_utils_1 = require("./object.utils"); | ||
@@ -121,3 +122,3 @@ var DateUtils = /** @class */ (function () { | ||
var month = isUTC ? date.getUTCMonth() + 1 : date.getMonth() + 1; | ||
return month >= 10 ? month.toString() : "0" + month; | ||
return month >= 10 ? month.toString() : "0".concat(month); | ||
case "M": | ||
@@ -129,3 +130,3 @@ return (isUTC | ||
var day = isUTC ? date.getUTCDate() : date.getDate(); | ||
return day >= 10 ? day.toString() : "0" + day; | ||
return day >= 10 ? day.toString() : "0".concat(day); | ||
case "d": | ||
@@ -135,3 +136,3 @@ return (isUTC ? date.getUTCDate() : date.getDate()).toString(); | ||
var hour = isUTC ? date.getUTCHours() : date.getHours(); | ||
return hour >= 10 ? hour.toString() : "0" + hour; | ||
return hour >= 10 ? hour.toString() : "0".concat(hour); | ||
case "H": | ||
@@ -141,3 +142,3 @@ return (isUTC ? date.getUTCHours() : date.getHours()).toString(); | ||
var min = isUTC ? date.getUTCMinutes() : date.getMinutes(); | ||
return min >= 10 ? min.toString() : "0" + min; | ||
return min >= 10 ? min.toString() : "0".concat(min); | ||
case "m": | ||
@@ -147,3 +148,3 @@ return (isUTC ? date.getUTCMinutes() : date.getMinutes()).toString(); | ||
var seconds = isUTC ? date.getUTCSeconds() : date.getSeconds(); | ||
return seconds >= 10 ? seconds.toString() : "0" + seconds; | ||
return seconds >= 10 ? seconds.toString() : "0".concat(seconds); | ||
case "s": | ||
@@ -158,4 +159,4 @@ return (isUTC ? date.getUTCSeconds() : date.getSeconds()).toString(); | ||
: milliseconds >= 10 | ||
? "0" + milliseconds | ||
: "00" + milliseconds; | ||
? "0".concat(milliseconds) | ||
: "00".concat(milliseconds); | ||
case "S": | ||
@@ -162,0 +163,0 @@ return (isUTC |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HttpUtils = void 0; | ||
var object_utils_1 = require("./object.utils"); | ||
@@ -4,0 +5,0 @@ var HttpUtils = /** @class */ (function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NumberUtils = void 0; | ||
var object_utils_1 = require("./object.utils"); | ||
@@ -4,0 +5,0 @@ // isInteger and isSafeInteger cannot be found in IE |
@@ -141,2 +141,14 @@ export declare class ObjectUtils { | ||
static hasValue<T>(object: T): object is NonNullable<T>; | ||
/** | ||
* if test is true, execute action | ||
* @param test whether is true | ||
* @param action action | ||
*/ | ||
static ifTrue(test: boolean, action: () => void): void; | ||
/** | ||
* if test is false, execute action | ||
* @param test whether is false | ||
* @param action action | ||
*/ | ||
static ifFalse(test: boolean, action: () => void): void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ObjectUtils = void 0; | ||
var __1 = require(".."); | ||
@@ -215,2 +216,22 @@ var ObjectUtils = /** @class */ (function () { | ||
}; | ||
/** | ||
* if test is true, execute action | ||
* @param test whether is true | ||
* @param action action | ||
*/ | ||
ObjectUtils.ifTrue = function (test, action) { | ||
if (test) { | ||
action(); | ||
} | ||
}; | ||
/** | ||
* if test is false, execute action | ||
* @param test whether is false | ||
* @param action action | ||
*/ | ||
ObjectUtils.ifFalse = function (test, action) { | ||
if (!test) { | ||
action(); | ||
} | ||
}; | ||
return ObjectUtils; | ||
@@ -217,0 +238,0 @@ }()); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RegexUtils = void 0; | ||
var RegexUtils = /** @class */ (function () { | ||
@@ -4,0 +5,0 @@ function RegexUtils() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StringUtils = void 0; | ||
var number_utils_1 = require("./number.utils"); | ||
@@ -4,0 +5,0 @@ var object_utils_1 = require("./object.utils"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ThreadUtils = void 0; | ||
var ThreadUtils = /** @class */ (function () { | ||
@@ -4,0 +5,0 @@ function ThreadUtils() { |
{ | ||
"name": "ts-commons", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"description": "common methods for typescript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
208786
2147