@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.
@@ -164,14 +164,14 @@
164
164
 
165
165
  /**
166
166
  * Assigns default values from source objects to target object for undefined properties.
167
- * @param {Object<string, any>} target - The target object to assign defaults to
168
- * @param {...Object<string, any>} sources - Source objects containing default values
169
- * @returns {Object<string, any>} The modified target object with defaults applied
170
- * @throws {TypeError} If target is null or undefined
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" must not be null or undefined')
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(`Empty String: ${str}`)
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(`Blank String: ${str}`)
1186
+ throw new Error(`${paramName ? '"' + paramName + '" ' : ''}Is Blank: ${str}`)
1184
1187
  }
1185
1188
  }
1186
1189