@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.
@@ -158,14 +158,14 @@ function constructorName (value) {
158
158
 
159
159
  /**
160
160
  * Assigns default values from source objects to target object for undefined properties.
161
- * @param {Object<string, any>} target - The target object to assign defaults to
162
- * @param {...Object<string, any>} sources - Source objects containing default values
163
- * @returns {Object<string, any>} The modified target object with defaults applied
164
- * @throws {TypeError} If target is null or undefined
161
+ * 1. No Deep-Copy, only first level properties are assigned.
162
+ * @param {{[key:string]:any}} target - The target object to assign defaults to
163
+ * @param {...{[key:string]:any}|undefined} sources - Source objects containing default values
164
+ * @returns {{[key:string]:any}} The modified target object with defaults applied
165
165
  */
166
166
  function defaults (target, ...sources) {
167
167
  if (target == null) {
168
- throw new TypeError('"target" must not be null or undefined')
168
+ throw new TypeError('"target" Should Not Nil')
169
169
  }
170
170
  for (const source of sources) {
171
171
  if (source == null) {
@@ -1145,11 +1145,13 @@ function isEmpty (str) {
1145
1145
  /**
1146
1146
  * Asserts that the given string is not empty.
1147
1147
  * @param {string} str - The string to check.
1148
+ * @param {string} [paramName]
1149
+ *
1148
1150
  * @throws {Error} Throws an error if the string is empty.
1149
1151
  */
1150
- function assertNotEmpty (str) {
1152
+ function assertNotEmpty (str, paramName) {
1151
1153
  if (isEmpty(str)) {
1152
- throw new Error(`Empty String: ${str}`)
1154
+ throw new Error(`${paramName ? '"' + paramName + '" ' : ''}IsEmpty String: ${str}`)
1153
1155
  }
1154
1156
  }
1155
1157
 
@@ -1170,11 +1172,12 @@ function isBlank (str) {
1170
1172
  /**
1171
1173
  * Asserts that the given string is not blank.
1172
1174
  * @param {string} str - The string to check.
1175
+ * @param {string} [paramName]
1173
1176
  * @throws {Error} Throws an error if the string is blank.
1174
1177
  */
1175
- function assertNotBlank (str) {
1178
+ function assertNotBlank (str, paramName) {
1176
1179
  if (isBlank(str)) {
1177
- throw new Error(`Blank String: ${str}`)
1180
+ throw new Error(`${paramName ? '"' + paramName + '" ' : ''}Is Blank: ${str}`)
1178
1181
  }
1179
1182
  }
1180
1183