@creejs/commons-lang 2.1.24 → 2.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-dev.cjs +12 -9
- package/dist/cjs/index-dev.cjs.map +1 -1
- package/dist/cjs/index-min.cjs +1 -1
- package/dist/cjs/index-min.cjs.map +1 -1
- package/dist/esm/index-dev.js +12 -9
- package/dist/esm/index-dev.js.map +1 -1
- package/dist/esm/index-min.js +1 -1
- package/dist/esm/index-min.js.map +1 -1
- package/dist/umd/index.dev.js +12 -9
- package/dist/umd/index.dev.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
- package/types/lang-utils.d.ts +9 -9
- package/types/string-utils.d.ts +5 -2
package/dist/cjs/index-dev.cjs
CHANGED
|
@@ -162,14 +162,14 @@ function constructorName (value) {
|
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Assigns default values from source objects to target object for undefined properties.
|
|
165
|
-
*
|
|
166
|
-
* @param {
|
|
167
|
-
* @
|
|
168
|
-
* @
|
|
165
|
+
* 1. No Deep-Copy, only first level properties are assigned.
|
|
166
|
+
* @param {{[key:string]:any}} target - The target object to assign defaults to
|
|
167
|
+
* @param {...{[key:string]:any}|undefined} sources - Source objects containing default values
|
|
168
|
+
* @returns {{[key:string]:any}} The modified target object with defaults applied
|
|
169
169
|
*/
|
|
170
170
|
function defaults (target, ...sources) {
|
|
171
171
|
if (target == null) {
|
|
172
|
-
throw new TypeError('"target"
|
|
172
|
+
throw new TypeError('"target" Should Not Nil')
|
|
173
173
|
}
|
|
174
174
|
for (const source of sources) {
|
|
175
175
|
if (source == null) {
|
|
@@ -1149,11 +1149,13 @@ function isEmpty (str) {
|
|
|
1149
1149
|
/**
|
|
1150
1150
|
* Asserts that the given string is not empty.
|
|
1151
1151
|
* @param {string} str - The string to check.
|
|
1152
|
+
* @param {string} [paramName]
|
|
1153
|
+
*
|
|
1152
1154
|
* @throws {Error} Throws an error if the string is empty.
|
|
1153
1155
|
*/
|
|
1154
|
-
function assertNotEmpty (str) {
|
|
1156
|
+
function assertNotEmpty (str, paramName) {
|
|
1155
1157
|
if (isEmpty(str)) {
|
|
1156
|
-
throw new Error(
|
|
1158
|
+
throw new Error(`${paramName ? '"' + paramName + '" ' : ''}IsEmpty String: ${str}`)
|
|
1157
1159
|
}
|
|
1158
1160
|
}
|
|
1159
1161
|
|
|
@@ -1174,11 +1176,12 @@ function isBlank (str) {
|
|
|
1174
1176
|
/**
|
|
1175
1177
|
* Asserts that the given string is not blank.
|
|
1176
1178
|
* @param {string} str - The string to check.
|
|
1179
|
+
* @param {string} [paramName]
|
|
1177
1180
|
* @throws {Error} Throws an error if the string is blank.
|
|
1178
1181
|
*/
|
|
1179
|
-
function assertNotBlank (str) {
|
|
1182
|
+
function assertNotBlank (str, paramName) {
|
|
1180
1183
|
if (isBlank(str)) {
|
|
1181
|
-
throw new Error(
|
|
1184
|
+
throw new Error(`${paramName ? '"' + paramName + '" ' : ''}Is Blank: ${str}`)
|
|
1182
1185
|
}
|
|
1183
1186
|
}
|
|
1184
1187
|
|