@danielhaim/titlecaser 1.3.0 → 1.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielhaim/titlecaser",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Converts a string to title case with multiple style options, ability to ignore certain words, and handle acronyms",
5
5
  "keywords": [
6
6
  "title case",
@@ -52,7 +52,7 @@
52
52
  "tree": "tree -a -I 'node_modules|.git|.DS_Store'"
53
53
  },
54
54
  "devDependencies": {
55
- "@babel/cli": "^7.21.5",
55
+ "@babel/cli": "^7.23.9",
56
56
  "@babel/core": "^7.22.1",
57
57
  "@babel/plugin-proposal-class-properties": "^7.18.6",
58
58
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
@@ -66,12 +66,12 @@
66
66
  "exports-loader": "^5.0.0",
67
67
  "jest": "^29.7.0",
68
68
  "jest-environment-jsdom": "^29.5.0",
69
- "jest-environment-puppeteer": "^9.0.0",
70
- "jest-puppeteer": "^9.0.0",
71
- "puppeteer": "^21.9.0",
72
- "puppeteer-core": "^21.9.0",
69
+ "jest-environment-puppeteer": "^10.0.1",
70
+ "jest-puppeteer": "^10.0.1",
71
+ "puppeteer": "^22.1.0",
72
+ "puppeteer-core": "^22.1.0",
73
73
  "terser-webpack-plugin": "^5.3.9",
74
- "webpack": "^5.90.0",
74
+ "webpack": "^5.90.2",
75
75
  "webpack-cli": "^5.1.4",
76
76
  "webpack-node-externals": "^3.0.0"
77
77
  },
package/src/TitleCaser.js CHANGED
@@ -278,15 +278,14 @@ export class TitleCaser {
278
278
  throw new TypeError("Invalid argument: term and replacement must be strings.");
279
279
  }
280
280
 
281
+ const index = this.wordReplacementsList.findIndex((obj) => Object.keys(obj)[0] === term);
282
+
281
283
  if (index !== -1) {
282
- // If the term already exists in the array, update the replacement value
283
284
  this.wordReplacementsList[index][term] = replacement;
284
285
  } else {
285
- // If the term doesn't exist in the array, add a new object with the term and replacement
286
286
  this.wordReplacementsList.push({ [term]: replacement });
287
287
  }
288
288
 
289
- // Update the replace terms option
290
289
  this.options.wordReplacementsList = this.wordReplacementsList;
291
290
  }
292
291