@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/umd/index.dev.js
CHANGED
|
@@ -164,14 +164,14 @@
|
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Assigns default values from source objects to target object for undefined properties.
|
|
167
|
-
*
|
|
168
|
-
* @param {
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
167
|
+
* 1. No Deep-Copy, only first level properties are assigned.
|
|
168
|
+
* @param {{[key:string]:any}} target - The target object to assign defaults to
|
|
169
|
+
* @param {...{[key:string]:any}|undefined} sources - Source objects containing default values
|
|
170
|
+
* @returns {{[key:string]:any}} The modified target object with defaults applied
|
|
171
171
|
*/
|
|
172
172
|
function defaults (target, ...sources) {
|
|
173
173
|
if (target == null) {
|
|
174
|
-
throw new TypeError('"target"
|
|
174
|
+
throw new TypeError('"target" Should Not Nil')
|
|
175
175
|
}
|
|
176
176
|
for (const source of sources) {
|
|
177
177
|
if (source == null) {
|
|
@@ -1151,11 +1151,13 @@
|
|
|
1151
1151
|
/**
|
|
1152
1152
|
* Asserts that the given string is not empty.
|
|
1153
1153
|
* @param {string} str - The string to check.
|
|
1154
|
+
* @param {string} [paramName]
|
|
1155
|
+
*
|
|
1154
1156
|
* @throws {Error} Throws an error if the string is empty.
|
|
1155
1157
|
*/
|
|
1156
|
-
function assertNotEmpty (str) {
|
|
1158
|
+
function assertNotEmpty (str, paramName) {
|
|
1157
1159
|
if (isEmpty(str)) {
|
|
1158
|
-
throw new Error(
|
|
1160
|
+
throw new Error(`${paramName ? '"' + paramName + '" ' : ''}IsEmpty String: ${str}`)
|
|
1159
1161
|
}
|
|
1160
1162
|
}
|
|
1161
1163
|
|
|
@@ -1176,11 +1178,12 @@
|
|
|
1176
1178
|
/**
|
|
1177
1179
|
* Asserts that the given string is not blank.
|
|
1178
1180
|
* @param {string} str - The string to check.
|
|
1181
|
+
* @param {string} [paramName]
|
|
1179
1182
|
* @throws {Error} Throws an error if the string is blank.
|
|
1180
1183
|
*/
|
|
1181
|
-
function assertNotBlank (str) {
|
|
1184
|
+
function assertNotBlank (str, paramName) {
|
|
1182
1185
|
if (isBlank(str)) {
|
|
1183
|
-
throw new Error(
|
|
1186
|
+
throw new Error(`${paramName ? '"' + paramName + '" ' : ''}Is Blank: ${str}`)
|
|
1184
1187
|
}
|
|
1185
1188
|
}
|
|
1186
1189
|
|