@stryke/string-format 0.6.1 → 0.6.2

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.
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.camelCase = camelCase;
7
7
  exports.isCamelCase = isCamelCase;
8
+ var _acronyms = require("./acronyms.cjs");
8
9
  var _lowerCaseFirst = require("./lower-case-first.cjs");
9
10
  var _pascalCase = require("./pascal-case.cjs");
10
11
  function isCamelCase(e) {
11
- return e ? /^[a-z][a-zA-Z0-9]*$/.test(e) : !1;
12
+ return e ? /^[a-z][a-z0-9]*$/.test(e) && _acronyms.ACRONYMS.includes(e) || /^(?:[a-z][a-z0-9]*[A-Z]+)*$/.test(e) : !1;
12
13
  }
13
14
  function camelCase(e) {
14
15
  return isCamelCase(e) || e === void 0 ? e : (0, _lowerCaseFirst.lowerCaseFirst)((0, _pascalCase.pascalCase)(e));
@@ -1 +1 @@
1
- import{lowerCaseFirst as r}from"./lower-case-first";import{pascalCase as a}from"./pascal-case";export function isCamelCase(e){return e?/^[a-z][a-zA-Z0-9]*$/.test(e):!1}export function camelCase(e){return isCamelCase(e)||e===void 0?e:r(a(e))}
1
+ import{ACRONYMS as r}from"./acronyms";import{lowerCaseFirst as a}from"./lower-case-first";import{pascalCase as s}from"./pascal-case";export function isCamelCase(e){return e?/^[a-z][a-z0-9]*$/.test(e)&&r.includes(e)||/^(?:[a-z][a-z0-9]*[A-Z]+)*$/.test(e):!1}export function camelCase(e){return isCamelCase(e)||e===void 0?e:a(s(e))}
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isPascalCase = isPascalCase;
7
7
  exports.pascalCase = pascalCase;
8
+ var _acronyms = require("./acronyms.cjs");
8
9
  var _getWords = require("./get-words.cjs");
9
10
  function isPascalCase(e) {
10
- return e ? /^[A-Z][a-zA-Z0-9]*$/.test(e) : !1;
11
+ return e ? /^[A-Z][A-Z0-9]*$/.test(e) && _acronyms.ACRONYMS.includes(e) || /^(?:[A-Z][A-Z0-9]*[a-z]+)*$/.test(e) : !1;
11
12
  }
12
13
  function pascalCase(e) {
13
- return e === void 0 ? e : (0, _getWords.getWords)(e).map(n => n.length > 0 ? n.trim().charAt(0).toUpperCase() + n.trim().slice(1) : "").join("");
14
+ return isPascalCase(e) || e === void 0 ? e : (0, _getWords.getWords)(e).map(r => r.length > 0 ? r.trim().charAt(0).toUpperCase() + r.trim().slice(1) : "").join("");
14
15
  }
@@ -1 +1 @@
1
- import{getWords as r}from"./get-words";export function isPascalCase(e){return e?/^[A-Z][a-zA-Z0-9]*$/.test(e):!1}export function pascalCase(e){return e===void 0?e:r(e).map(n=>n.length>0?n.trim().charAt(0).toUpperCase()+n.trim().slice(1):"").join("")}
1
+ import{ACRONYMS as s}from"./acronyms";import{getWords as t}from"./get-words";export function isPascalCase(e){return e?/^[A-Z][A-Z0-9]*$/.test(e)&&s.includes(e)||/^(?:[A-Z][A-Z0-9]*[a-z]+)*$/.test(e):!1}export function pascalCase(e){return isPascalCase(e)||e===void 0?e:t(e).map(r=>r.length>0?r.trim().charAt(0).toUpperCase()+r.trim().slice(1):"").join("")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/string-format",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions to transform strings into various formats.",
6
6
  "repository": {
@@ -333,5 +333,5 @@
333
333
  "main": "./dist/index.cjs",
334
334
  "module": "./dist/index.mjs",
335
335
  "types": "./dist/index.d.ts",
336
- "gitHead": "65b0557df259542217c34e7e93413b662359e3d3"
336
+ "gitHead": "7aac00edc2ff843fb756d37cdcaf482e2da4472b"
337
337
  }