@stryke/string-format 0.4.8 → 0.4.9

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.
@@ -7,5 +7,7 @@ exports.titleCase = titleCase;
7
7
  var _acronyms = require("./acronyms.cjs");
8
8
  var _upperCaseFirst = require("./upper-case-first.cjs");
9
9
  function titleCase(e) {
10
- return e && e.toLowerCase().split(" ").filter(Boolean).map(r => _acronyms.ACRONYMS.includes(r.toUpperCase()) ? r.toUpperCase() : `${(0, _upperCaseFirst.upperCaseFirst)(r.toLowerCase())}`).join(" ");
10
+ if (!e) return e;
11
+ const s = t => t.toLowerCase().split(/[\s\-_]+/).filter(Boolean).map(r => _acronyms.ACRONYMS.includes(r.toUpperCase()) ? r.toUpperCase() : `${(0, _upperCaseFirst.upperCaseFirst)(r.toLowerCase())}`).join(" ");
12
+ return e.split(/\s+-\s+/).map(t => s(t)).join(" - ");
11
13
  }
@@ -1 +1 @@
1
- import{ACRONYMS as t}from"./acronyms";import{upperCaseFirst as o}from"./upper-case-first";export function titleCase(e){return e&&e.toLowerCase().split(" ").filter(Boolean).map(r=>t.includes(r.toUpperCase())?r.toUpperCase():`${o(r.toLowerCase())}`).join(" ")}
1
+ import{ACRONYMS as o}from"./acronyms";import{upperCaseFirst as n}from"./upper-case-first";export function titleCase(e){if(!e)return e;const s=t=>t.toLowerCase().split(/[\s\-_]+/).filter(Boolean).map(r=>o.includes(r.toUpperCase())?r.toUpperCase():`${n(r.toLowerCase())}`).join(" ");return e.split(/\s+-\s+/).map(t=>s(t)).join(" - ")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/string-format",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions to transform strings into various formats.",
6
6
  "repository": {