@stryke/string-format 0.1.7 â 0.2.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/README.md +1 -5
- package/dist/kebab-case.cjs +1 -1
- package/dist/kebab-case.mjs +1 -1
- package/dist/normalize-email.cjs +1 -1
- package/dist/normalize-email.d.ts +2 -2
- package/dist/normalize-email.mjs +1 -1
- package/dist/period-split.cjs +1 -1
- package/dist/period-split.mjs +1 -1
- package/dist/pretty-bytes.d.ts +1 -1
- package/dist/snake-case.cjs +2 -2
- package/dist/snake-case.mjs +1 -1
- package/dist/unescape.cjs +2 -2
- package/dist/unescape.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<!-- prettier-ignore-start -->
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
<div align="center"><img src="https://pub-761b436209f44a4d886487c917806c08.r2.dev/storm-banner.gif" width="100%" alt="Storm Software" /></div>
|
|
7
6
|
<br />
|
|
8
7
|
|
|
@@ -22,7 +21,7 @@ This package is part of Storm Software's **đŠī¸ Stryke** monorepo. Stryke pac
|
|
|
22
21
|
|
|
23
22
|
<h3 align="center">đģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
23
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
25
|
|
|
27
26
|
> [!IMPORTANT] This repository, and the apps, libraries, and tools contained
|
|
28
27
|
> within, is still in it's initial development phase. As a result, bugs and
|
|
@@ -38,7 +37,6 @@ This package is part of Storm Software's **đŠī¸ Stryke** monorepo. Stryke pac
|
|
|
38
37
|
|
|
39
38
|
<br />
|
|
40
39
|
|
|
41
|
-
|
|
42
40
|
<!-- markdownlint-restore -->
|
|
43
41
|
<!-- prettier-ignore-end -->
|
|
44
42
|
|
|
@@ -127,7 +125,6 @@ Run `nx lint string-format` to run [ESLint](https://eslint.org/) on the package.
|
|
|
127
125
|
<!-- prettier-ignore-start -->
|
|
128
126
|
<!-- markdownlint-disable -->
|
|
129
127
|
|
|
130
|
-
|
|
131
128
|
## Storm Workspaces
|
|
132
129
|
|
|
133
130
|
Storm workspaces are built using
|
|
@@ -289,7 +286,6 @@ generation of development tools, please reach out on our
|
|
|
289
286
|
<br />
|
|
290
287
|
<br />
|
|
291
288
|
|
|
292
|
-
|
|
293
289
|
<!-- markdownlint-restore -->
|
|
294
290
|
<!-- prettier-ignore-end -->
|
|
295
291
|
|
package/dist/kebab-case.cjs
CHANGED
|
@@ -7,7 +7,7 @@ exports.kebabCase = void 0;
|
|
|
7
7
|
var _types = require("@stryke/types");
|
|
8
8
|
var _upperCaseFirst = require("./upper-case-first.cjs");
|
|
9
9
|
const kebabCase = t => {
|
|
10
|
-
const e = t?.replace(/
|
|
10
|
+
const e = t?.replace(/[A-Z]+/g, r => (0, _upperCaseFirst.upperCaseFirst)(r) ?? _types.EMPTY_STRING)?.split(/(?=[A-Z])|[\s._-]/).map(r => r.toLowerCase()) ?? [];
|
|
11
11
|
return e.length === 0 ? "" : e.length === 1 ? e[0] : e.reduce((r, s) => `${r}-${s.toLowerCase()}`.toLowerCase());
|
|
12
12
|
};
|
|
13
13
|
exports.kebabCase = kebabCase;
|
package/dist/kebab-case.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EMPTY_STRING as n}from"@stryke/types";import{upperCaseFirst as o}from"./upper-case-first";export const kebabCase=t=>{const e=t?.replace(/
|
|
1
|
+
import{EMPTY_STRING as n}from"@stryke/types";import{upperCaseFirst as o}from"./upper-case-first";export const kebabCase=t=>{const e=t?.replace(/[A-Z]+/g,r=>o(r)??n)?.split(/(?=[A-Z])|[\s._-]/).map(r=>r.toLowerCase())??[];return e.length===0?"":e.length===1?e[0]:e.reduce((r,s)=>`${r}-${s.toLowerCase()}`.toLowerCase())};
|
package/dist/normalize-email.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const normalizeEmail = e => {
|
|
|
13
13
|
let [r] = i.split("+");
|
|
14
14
|
if (!r) throw new Error("invalid_email_format");
|
|
15
15
|
r = r.replace(l, "");
|
|
16
|
-
const t = r.toLowerCase()
|
|
16
|
+
const t = `${r.toLowerCase()}@${n.toLowerCase()}`;
|
|
17
17
|
return Number(t), t;
|
|
18
18
|
};
|
|
19
19
|
exports.normalizeEmail = normalizeEmail;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* For example, this email
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Mike.Johnson+twitter\@Gmail.com
|
|
10
10
|
*
|
|
11
11
|
* will be normalized to
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* mikejohnson\@gmail.com
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export declare const normalizeEmail: (email: string) => string;
|
package/dist/normalize-email.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=/\./g;export const normalizeEmail=e=>{if(!e.includes("@")&&!e.includes("+"))throw new Error("invalid_email_format");const o=e.split("@").filter(Boolean);if(o.length>1)throw new Error("invalid_email_format");const[i,n]=o;let[r]=i.split("+");if(!r)throw new Error("invalid_email_format");r=r.replace(l,"");const t
|
|
1
|
+
const l=/\./g;export const normalizeEmail=e=>{if(!e.includes("@")&&!e.includes("+"))throw new Error("invalid_email_format");const o=e.split("@").filter(Boolean);if(o.length>1)throw new Error("invalid_email_format");const[i,n]=o;let[r]=i.split("+");if(!r)throw new Error("invalid_email_format");r=r.replace(l,"");const t=`${r.toLowerCase()}@${n.toLowerCase()}`;return Number(t),t};
|
package/dist/period-split.cjs
CHANGED
|
@@ -7,7 +7,7 @@ exports.periodSplit = void 0;
|
|
|
7
7
|
var _types = require("@stryke/types");
|
|
8
8
|
var _upperCaseFirst = require("./upper-case-first.cjs");
|
|
9
9
|
const periodSplit = e => {
|
|
10
|
-
const t = e?.replace(/
|
|
10
|
+
const t = e?.replace(/[A-Z]+/g, r => (0, _upperCaseFirst.upperCaseFirst)(r) ?? _types.EMPTY_STRING)?.split(/(?=[A-Z])|[\s._-]/).map(r => r.toLowerCase()) ?? [];
|
|
11
11
|
return t.length === 0 ? "" : t.length === 1 ? t[0] : t.reduce((r, n) => `${r}.${n.toLowerCase()}`.toLowerCase());
|
|
12
12
|
};
|
|
13
13
|
exports.periodSplit = periodSplit;
|
package/dist/period-split.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EMPTY_STRING as s}from"@stryke/types";import{upperCaseFirst as i}from"./upper-case-first";export const periodSplit=e=>{const t=e?.replace(/
|
|
1
|
+
import{EMPTY_STRING as s}from"@stryke/types";import{upperCaseFirst as i}from"./upper-case-first";export const periodSplit=e=>{const t=e?.replace(/[A-Z]+/g,r=>i(r)??s)?.split(/(?=[A-Z])|[\s._-]/).map(r=>r.toLowerCase())??[];return t.length===0?"":t.length===1?t[0]:t.reduce((r,n)=>`${r}.${n.toLowerCase()}`.toLowerCase())};
|
package/dist/pretty-bytes.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface Options {
|
|
|
3
3
|
* Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
|
|
4
4
|
*
|
|
5
5
|
* @defaultValue false
|
|
6
|
-
|
|
6
|
+
*/
|
|
7
7
|
readonly signed?: boolean;
|
|
8
8
|
/**
|
|
9
9
|
* - If `false`: Output won't be localized.
|
package/dist/snake-case.cjs
CHANGED
|
@@ -8,10 +8,10 @@ var _types = require("@stryke/types");
|
|
|
8
8
|
var _upperCaseFirst = require("./upper-case-first.cjs");
|
|
9
9
|
const snakeCase = (t, n) => {
|
|
10
10
|
if (!t) return "";
|
|
11
|
-
const r = t?.replace(/
|
|
11
|
+
const r = t?.replace(/[A-Z]+/g, e => (0, _upperCaseFirst.upperCaseFirst)(e) ?? _types.EMPTY_STRING).split(/(?=[A-Z])|[\s._-]/).map(e => e.toLowerCase()) ?? [];
|
|
12
12
|
if (r.length === 0) return "";
|
|
13
13
|
if (r.length === 1) return r[0];
|
|
14
14
|
const s = r.reduce((e, i) => `${e}_${i.toLowerCase()}`);
|
|
15
|
-
return n?.splitOnNumber === !1 ? s : s.replace(/
|
|
15
|
+
return n?.splitOnNumber === !1 ? s : s.replace(/[A-Z]\d/i, e => `${e[0]}_${e[1]}`);
|
|
16
16
|
};
|
|
17
17
|
exports.snakeCase = snakeCase;
|
package/dist/snake-case.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EMPTY_STRING as o}from"@stryke/types";import{upperCaseFirst as a}from"./upper-case-first";export const snakeCase=(t,n)=>{if(!t)return"";const r=t?.replace(/
|
|
1
|
+
import{EMPTY_STRING as o}from"@stryke/types";import{upperCaseFirst as a}from"./upper-case-first";export const snakeCase=(t,n)=>{if(!t)return"";const r=t?.replace(/[A-Z]+/g,e=>a(e)??o).split(/(?=[A-Z])|[\s._-]/).map(e=>e.toLowerCase())??[];if(r.length===0)return"";if(r.length===1)return r[0];const s=r.reduce((e,i)=>`${e}_${i.toLowerCase()}`);return n?.splitOnNumber===!1?s:s.replace(/[A-Z]\d/i,e=>`${e[0]}_${e[1]}`)};
|
package/dist/unescape.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.unescape = unescape;
|
|
7
|
-
const
|
|
7
|
+
const e = {
|
|
8
8
|
"&": "&",
|
|
9
9
|
"<": "<",
|
|
10
10
|
">": ">",
|
|
@@ -12,5 +12,5 @@ const n = {
|
|
|
12
12
|
"'": "'"
|
|
13
13
|
};
|
|
14
14
|
function unescape(t) {
|
|
15
|
-
return t.replace(/&(?:amp|lt|gt|quot|#
|
|
15
|
+
return t.replace(/&(?:amp|lt|gt|quot|#0*39);/g, n => e[n] || "'");
|
|
16
16
|
}
|
package/dist/unescape.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e={"&":"&","<":"<",">":">",""":'"',"'":"'"};export function unescape(t){return t.replace(/&(?:amp|lt|gt|quot|#0*39);/g,n=>e[n]||"'")}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/string-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing utility functions to transform strings into various formats.",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"private": false,
|
|
12
12
|
"publishConfig": { "access": "public" },
|
|
13
|
-
"dependencies": { "@stryke/helpers": ">=0.
|
|
13
|
+
"dependencies": { "@stryke/helpers": ">=0.3.0", "@stryke/types": ">=0.4.0" },
|
|
14
14
|
"devDependencies": {},
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"files": ["dist/**/*"],
|