ts-commons
Advanced tools
Comparing version 0.0.37 to 0.0.38
@@ -0,0 +0,0 @@ { |
export declare class ArrayUtils { | ||
/** | ||
* check whether current array is empty. | ||
* eg: ArrayUtils.isEmpty([]) = true; | ||
* eg: ArrayUtils.isEmpty(null) = true; | ||
* eg: ArrayUtils.isEmpty(underfind) = true; | ||
* eg: ArrayUtils.isEmtpy([1]) = fase; | ||
* eg: ArrayUtils.isEmtpy("string") = fase; | ||
* eg: ArrayUtils.isEmtpy(123) = fase; | ||
* @param array | ||
*/ | ||
static isEmpty<T>(array: T[]): boolean; | ||
/** | ||
* Determines whether an element is in the array. | ||
* @param array | ||
* @param obj | ||
*/ | ||
static contains<T>(array: T[], obj: T): boolean; | ||
@@ -4,0 +19,0 @@ static containsAny<T>(array: T[], candidates: T[]): boolean; |
@@ -5,9 +5,29 @@ "use strict"; | ||
var number_utils_1 = require("./number.utils"); | ||
// from org.springframework.util.CollectionUtils | ||
var ArrayUtils = /** @class */ (function () { | ||
function ArrayUtils() { | ||
} | ||
/** | ||
* check whether current array is empty. | ||
* eg: ArrayUtils.isEmpty([]) = true; | ||
* eg: ArrayUtils.isEmpty(null) = true; | ||
* eg: ArrayUtils.isEmpty(underfind) = true; | ||
* eg: ArrayUtils.isEmtpy([1]) = fase; | ||
* eg: ArrayUtils.isEmtpy("string") = fase; | ||
* eg: ArrayUtils.isEmtpy(123) = fase; | ||
* @param array | ||
*/ | ||
ArrayUtils.isEmpty = function (array) { | ||
return !object_utils_1.ObjectUtils.isArray(array) || array.length === 0; | ||
if (object_utils_1.ObjectUtils.isNullOrUndefined(array)) { | ||
return true; | ||
} | ||
if (!object_utils_1.ObjectUtils.isArray(array)) { | ||
return false; | ||
} | ||
return array.length === 0; | ||
}; | ||
/** | ||
* Determines whether an element is in the array. | ||
* @param array | ||
* @param obj | ||
*/ | ||
ArrayUtils.contains = function (array, obj) { | ||
@@ -14,0 +34,0 @@ if (this.isEmpty(array) || object_utils_1.ObjectUtils.isNullOrUndefined(obj)) { |
@@ -18,3 +18,8 @@ "use strict"; | ||
} | ||
return new Date(timestamp * 1000); | ||
if (timestamp > 1000000000000) { | ||
return new Date(timestamp); | ||
} | ||
else { | ||
return new Date(timestamp * 1000); | ||
} | ||
}; | ||
@@ -21,0 +26,0 @@ return DateUtils; |
{ | ||
"name": "ts-commons", | ||
"version": "0.0.37", | ||
"version": "0.0.38", | ||
"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
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
0
66553
31
954