string-tools-lite-js 1.0.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/.github/workflows/publish.yml +28 -0
- package/package.json +1 -1
- package/src/index.js +11 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 20
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
|
|
23
|
+
- run: npm ci
|
|
24
|
+
- run: npm run build --if-present
|
|
25
|
+
|
|
26
|
+
- run: npm publish --access public
|
|
27
|
+
env:
|
|
28
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export function capitalize(str = '') {
|
|
2
2
|
if (!str) return '';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const strArr = str.split(' ');
|
|
5
|
+
|
|
6
|
+
console.log(strArr);
|
|
7
|
+
|
|
8
|
+
return strArr
|
|
9
|
+
.map(
|
|
10
|
+
(word) =>
|
|
11
|
+
word.charAt(0).toUpperCase() + word.slice(1).toLocaleLowerCase(),
|
|
12
|
+
)
|
|
13
|
+
.join(' ');
|
|
4
14
|
}
|
|
5
15
|
|
|
6
16
|
export function slugify(str = '') {
|