@danielhaim/titlecaser 1.2.40 → 1.2.42
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 -1
- package/index.js +25 -0
- package/package.json +29 -26
- package/src/TitleCaser.js +1 -8
- package/src/index.js +0 -14
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Transform any text to proper title case format using popular style guides such a
|
|
|
8
8
|
|
|
9
9
|
## Demo
|
|
10
10
|
|
|
11
|
-
<a target="_blank" href="https://danielhaim1.github.io/TitleCaser/"><img src="
|
|
11
|
+
<a target="_blank" href="https://danielhaim1.github.io/TitleCaser/"><img src="https://danielhaim1.github.io/TitleCaser/assets/demo.png" width="100%" height="auto"></a>
|
|
12
12
|
|
|
13
13
|
## Table of Contents
|
|
14
14
|
|
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/index.js
|
|
2
|
+
|
|
3
|
+
// Import the TitleCaser class from the file src/TitleCaser.js.
|
|
4
|
+
import { TitleCaser } from './src/TitleCaser.js';
|
|
5
|
+
|
|
6
|
+
// Add a new method to the String prototype. This method will be available
|
|
7
|
+
// to all string objects. This is the method that will be used to convert
|
|
8
|
+
// a string to title case.
|
|
9
|
+
if (String.prototype.toTitleCase === undefined) {
|
|
10
|
+
String.prototype.toTitleCase = function (options) {
|
|
11
|
+
const titleCaser = new TitleCaser(options);
|
|
12
|
+
return titleCaser.toTitleCase(this);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// If the module is being used in a Node environment, export the module.
|
|
17
|
+
if (typeof module === 'object' && module.exports) {
|
|
18
|
+
module.exports = { TitleCaser };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// If the module is being used in a web environment, make the TitleCaser
|
|
22
|
+
// class available in the window object.
|
|
23
|
+
if (typeof window !== 'undefined' && window.document) {
|
|
24
|
+
window.TitleCaser = TitleCaser;
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielhaim/titlecaser",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.42",
|
|
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",
|
|
@@ -23,53 +23,56 @@
|
|
|
23
23
|
"Chicago Manual of Style",
|
|
24
24
|
"British style"
|
|
25
25
|
],
|
|
26
|
+
"homepage": "https://github.com/danielhaim1/titlecaser#readme",
|
|
27
|
+
"bugs": "https://github.com/danielhaim1/titlecaser/issues",
|
|
26
28
|
"repository": {
|
|
27
29
|
"type": "git",
|
|
28
30
|
"url": "https://github.com/danielhaim1/titlecaser.git"
|
|
29
31
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"build-package": "webpack --mode production && terser dist/titlecaser.js -o dist/titlecaser.min.js",
|
|
35
|
-
"copy-package-to-docs": "cp -R dist/ docs/assets/js",
|
|
36
|
-
"tree": "tree -I 'node_modules'",
|
|
37
|
-
"release": "npm version patch && npm run build-package && npm run copy-package-to-docs && git add package.json package-lock.json dist/ docs/assets/js && git commit -m 'Bump version and build package for release' && git push"
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "Daniel Haim",
|
|
35
|
+
"url": "https://github.com/danielhaim1"
|
|
38
36
|
},
|
|
37
|
+
"main": "./src/TitleCaser.js",
|
|
39
38
|
"files": [
|
|
40
|
-
"package.json",
|
|
41
|
-
"src/TitleCaserConsts.js",
|
|
42
|
-
"src/TitleCaserUtils.js",
|
|
43
|
-
"src/TitleCaser.js",
|
|
44
|
-
"src/index.js",
|
|
45
39
|
"LICENSE",
|
|
46
|
-
"README.md"
|
|
40
|
+
"README.md",
|
|
41
|
+
"index.js",
|
|
42
|
+
"src/",
|
|
43
|
+
"package.json"
|
|
47
44
|
],
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build-docs": "cd docs && bundle install && bundle exec jekyll build",
|
|
47
|
+
"build-package": "webpack --mode production && terser dist/titlecaser.js -o dist/titlecaser.min.js",
|
|
48
|
+
"copy-package-to-docs": "cp -R dist/ docs/assets/js",
|
|
49
|
+
"release": "npm version patch && npm run build-package && npm run copy-package-to-docs && git add package.json package-lock.json dist/ docs/assets/js && git commit -m 'Bump version and build package for release' && git push",
|
|
50
|
+
"test": "jest",
|
|
51
|
+
"tree": "tree -I 'node_modules'"
|
|
51
52
|
},
|
|
52
|
-
"license": "MIT",
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@babel/cli": "^7.21.0",
|
|
55
55
|
"@babel/core": "^7.21.4",
|
|
56
56
|
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
|
|
57
57
|
"@babel/preset-env": "^7.21.4",
|
|
58
58
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
59
|
+
"@jest/expect": "^29.5.0",
|
|
60
|
+
"babel-jest": "^29.5.0",
|
|
59
61
|
"babel-loader": "^9.1.2",
|
|
60
62
|
"esbuild-jest": "^0.5.0",
|
|
61
63
|
"exports-loader": "^4.0.0",
|
|
62
|
-
"terser-webpack-plugin": "^5.3.7",
|
|
63
|
-
"webpack": "^5.78.0",
|
|
64
|
-
"webpack-cli": "^5.0.1",
|
|
65
|
-
"webpack-node-externals": "^3.0.0",
|
|
66
|
-
"@jest/expect": "^29.5.0",
|
|
67
|
-
"babel-jest": "^29.5.0",
|
|
68
64
|
"jest": "^29.5.0",
|
|
69
65
|
"jest-environment-jsdom": "^29.5.0",
|
|
70
66
|
"jest-environment-puppeteer": "^8.0.6",
|
|
71
67
|
"jest-puppeteer": "^8.0.6",
|
|
72
68
|
"puppeteer": "^19.8.5",
|
|
73
|
-
"puppeteer-core": "^19.8.5"
|
|
69
|
+
"puppeteer-core": "^19.8.5",
|
|
70
|
+
"terser-webpack-plugin": "^5.3.7",
|
|
71
|
+
"webpack": "^5.78.0",
|
|
72
|
+
"webpack-cli": "^5.0.1",
|
|
73
|
+
"webpack-node-externals": "^3.0.0"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
74
77
|
}
|
|
75
78
|
}
|
package/src/TitleCaser.js
CHANGED
|
@@ -220,11 +220,4 @@ export class TitleCaser {
|
|
|
220
220
|
|
|
221
221
|
this.options.style = style;
|
|
222
222
|
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// If the module is being used in a Node environment, export the module.
|
|
226
|
-
if (typeof module === 'object' && module.exports) {
|
|
227
|
-
module.exports = { TitleCaser };
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
223
|
+
}
|
package/src/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TitleCaser } from './TitleCaser.js';
|
|
2
|
-
|
|
3
|
-
if (typeof String.prototype.toTitleCase !== 'function') {
|
|
4
|
-
String.prototype.toTitleCase = function (options) {
|
|
5
|
-
const titleCaser = new TitleCaser(options);
|
|
6
|
-
return titleCaser.toTitleCase(this);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { TitleCaser };
|
|
11
|
-
|
|
12
|
-
if (typeof window === 'object') {
|
|
13
|
-
window.TitleCaser = TitleCaser;
|
|
14
|
-
}
|