ts-commons
Advanced tools
Comparing version 1.0.28 to 1.0.29
@@ -10,2 +10,3 @@ import { ArrayUtils } from "./utils/array.utils"; | ||
import { ActionUtils } from "./utils/action.utils"; | ||
export { ObjectUtils, StringUtils, NumberUtils, DateUtils, RegexUtils, HttpUtils, ArrayUtils, ThreadUtils, ActionUtils }; | ||
import { IOUtils } from "./utils/io.utils"; | ||
export { ObjectUtils, StringUtils, NumberUtils, DateUtils, RegexUtils, HttpUtils, ArrayUtils, ThreadUtils, ActionUtils, IOUtils, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ActionUtils = exports.ThreadUtils = exports.ArrayUtils = exports.HttpUtils = exports.RegexUtils = exports.DateUtils = exports.NumberUtils = exports.StringUtils = exports.ObjectUtils = void 0; | ||
exports.IOUtils = exports.ActionUtils = 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"); | ||
@@ -22,2 +22,4 @@ Object.defineProperty(exports, "ArrayUtils", { enumerable: true, get: function () { return array_utils_1.ArrayUtils; } }); | ||
Object.defineProperty(exports, "ActionUtils", { enumerable: true, get: function () { return action_utils_1.ActionUtils; } }); | ||
var io_utils_1 = require("./utils/io.utils"); | ||
Object.defineProperty(exports, "IOUtils", { enumerable: true, get: function () { return io_utils_1.IOUtils; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -122,3 +122,3 @@ "use strict"; | ||
var month = isUTC ? date.getUTCMonth() + 1 : date.getMonth() + 1; | ||
return month >= 10 ? month.toString() : "0".concat(month); | ||
return month >= 10 ? month.toString() : "0" + month; | ||
case "M": | ||
@@ -130,3 +130,3 @@ return (isUTC | ||
var day = isUTC ? date.getUTCDate() : date.getDate(); | ||
return day >= 10 ? day.toString() : "0".concat(day); | ||
return day >= 10 ? day.toString() : "0" + day; | ||
case "d": | ||
@@ -136,3 +136,3 @@ return (isUTC ? date.getUTCDate() : date.getDate()).toString(); | ||
var hour = isUTC ? date.getUTCHours() : date.getHours(); | ||
return hour >= 10 ? hour.toString() : "0".concat(hour); | ||
return hour >= 10 ? hour.toString() : "0" + hour; | ||
case "H": | ||
@@ -142,3 +142,3 @@ return (isUTC ? date.getUTCHours() : date.getHours()).toString(); | ||
var min = isUTC ? date.getUTCMinutes() : date.getMinutes(); | ||
return min >= 10 ? min.toString() : "0".concat(min); | ||
return min >= 10 ? min.toString() : "0" + min; | ||
case "m": | ||
@@ -148,3 +148,3 @@ return (isUTC ? date.getUTCMinutes() : date.getMinutes()).toString(); | ||
var seconds = isUTC ? date.getUTCSeconds() : date.getSeconds(); | ||
return seconds >= 10 ? seconds.toString() : "0".concat(seconds); | ||
return seconds >= 10 ? seconds.toString() : "0" + seconds; | ||
case "s": | ||
@@ -159,4 +159,4 @@ return (isUTC ? date.getUTCSeconds() : date.getSeconds()).toString(); | ||
: milliseconds >= 10 | ||
? "0".concat(milliseconds) | ||
: "00".concat(milliseconds); | ||
? "0" + milliseconds | ||
: "00" + milliseconds; | ||
case "S": | ||
@@ -163,0 +163,0 @@ return (isUTC |
@@ -18,3 +18,6 @@ export declare class HttpUtils { | ||
}; | ||
static mergeUrl(url: string, queryParams: { | ||
[key: string]: string; | ||
}, replaceOld: boolean): string; | ||
private static getParams; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
var object_utils_1 = require("./object.utils"); | ||
var string_utils_1 = require("./string.utils"); | ||
var HttpUtils = /** @class */ (function () { | ||
@@ -30,2 +31,31 @@ function HttpUtils() { | ||
}; | ||
HttpUtils.mergeUrl = function (url, queryParams, replaceOld) { | ||
var oldParams = this.getQueryParams(url); | ||
for (var key in queryParams) { | ||
if (oldParams.hasOwnProperty(key)) { | ||
if (replaceOld) { | ||
oldParams[key] = queryParams[key]; | ||
} | ||
} | ||
else { | ||
oldParams[key] = queryParams[key]; | ||
} | ||
} | ||
var query = ""; | ||
for (var key in oldParams) { | ||
var value = oldParams[key]; | ||
if (string_utils_1.StringUtils.isBlank(query)) { | ||
query += key + "=" + value; | ||
} | ||
else { | ||
query += "&" + key + "=" + value; | ||
} | ||
} | ||
if (string_utils_1.StringUtils.isBlank(query)) { | ||
return url; | ||
} | ||
else { | ||
return url.split("?")[0] + "?" + query; | ||
} | ||
}; | ||
// solve a=1[;|&]b=2[;|&]c=3 | ||
@@ -32,0 +62,0 @@ HttpUtils.getParams = function (paramStr, splitChar) { |
{ | ||
"name": "ts-commons", | ||
"version": "1.0.28", | ||
"version": "1.0.29", | ||
"description": "common methods for typescript", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
"clean": "del-cli .nyc_output && del-cli dist && del-cli .scannerwork && del-cli .idea && del-cli coverage", | ||
"build": "npm run deletedist && cross-env NODE_ENV=production webpack", | ||
"build": "npm run clean && cross-env NODE_ENV=production webpack", | ||
"analyze:sonar": "sonar-scanner -Dsonar.projectKey=wz2cool-github:ts-commons -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=wz2cool-github" | ||
@@ -66,3 +66,3 @@ }, | ||
"mocha-lcov-reporter": "~1.3.0", | ||
"nyc": "~12.0.2", | ||
"nyc": "~15.1.0", | ||
"rimraf": "^2.6.2", | ||
@@ -69,0 +69,0 @@ "sonarqube-scanner": "^2.4.0", |
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
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
258036
49
2272
1