@valkyriestudios/utils 12.17.0 → 12.17.1

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.
Files changed (2) hide show
  1. package/array/join.js +5 -2
  2. package/package.json +1 -1
package/array/join.js CHANGED
@@ -13,14 +13,17 @@ function join(val, opts) {
13
13
  const INNERTRIM = opts?.innertrim ?? false;
14
14
  const VALROUND = (0, isIntegerAboveOrEqual_1.isIntegerAboveOrEqual)(opts?.valround, 0) ? opts.valround : false;
15
15
  let result = '';
16
+ let hasVal = false;
16
17
  for (let i = 0; i < val.length; i++) {
17
18
  const el = val[i];
18
19
  if (typeof el === 'string' && el.trim().length) {
19
20
  const trimmed = VALTRIM ? el.trim() : el;
20
- result = `${result}${i !== 0 ? DELIM : ''}${INNERTRIM ? trimmed.replace(/(\s){2,}/g, ' ') : trimmed}`;
21
+ result = `${result}${hasVal ? DELIM : ''}${INNERTRIM ? trimmed.replace(/(\s){2,}/g, ' ') : trimmed}`;
22
+ hasVal = true;
21
23
  }
22
24
  else if (Number.isFinite(el)) {
23
- result = `${result}${i !== 0 ? DELIM : ''}${VALROUND !== false ? (0, round_1.round)(el, VALROUND) : el}`;
25
+ result = `${result}${hasVal ? DELIM : ''}${VALROUND !== false ? (0, round_1.round)(el, VALROUND) : el}`;
26
+ hasVal = true;
24
27
  }
25
28
  }
26
29
  return TRIM ? result.trim() : result;
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@valkyriestudios/utils", "version": "12.17.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "url": "https://www.linkedin.com/in/petervermeulen1/" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
1
+ { "name": "@valkyriestudios/utils", "version": "12.17.1", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "url": "https://www.linkedin.com/in/petervermeulen1/" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }