capitalize
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -12,5 +12,5 @@ module.exports = function (string, preserve) { | ||
} | ||
return string.replace(/(^|[^a-zA-Z\u00C0-\u017F\u0400-\u04FF'])([a-zA-Z\u00C0-\u017F\u0400-\u04FF])/g, function (m) { | ||
return string.replace(/(?!^[0-9])(^|[^a-zA-Z\u00C0-\u017F\u0400-\u04FF'])([a-zA-Z\u00C0-\u017F\u0400-\u04FF])/g, function (m) { | ||
return m.toUpperCase() | ||
}) | ||
} |
{ | ||
"name": "capitalize", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "capitalize the first letter of a string, or all words in a string", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
# capitalize | ||
# capitalize ![Build](https://github.com/grncdr/js-capitalize/workflows/Node%20CI/badge.svg) | ||
@@ -34,3 +34,3 @@ Capitalize the first letter of a string, or all words in a string. | ||
t.plan(2) | ||
t.test('...in upper case', function (t1) { | ||
@@ -40,3 +40,3 @@ t1.plan(1) | ||
}) | ||
t.test('...in mixed case', function (t2) { | ||
@@ -46,3 +46,3 @@ t2.plan(1) | ||
}) | ||
}) | ||
@@ -52,3 +52,3 @@ | ||
t.plan(2) | ||
t.test('...in upper case', function (t1) { | ||
@@ -58,3 +58,3 @@ t1.plan(1) | ||
}) | ||
t.test('...in mixed case', function (t2) { | ||
@@ -64,3 +64,3 @@ t2.plan(1) | ||
}) | ||
}) | ||
@@ -110,3 +110,12 @@ ``` | ||
and thanks to [@rubengmurray](https://github.com/grncdr/js-capitalize/pull/13), capitalize now handles shorthand ordinal numbers as would be expected: | ||
```javascript | ||
test('Capitalize words, handling shorthand ordinals (1st, 2nd, 3rd) correctly', function (t) { | ||
t.plan(1) | ||
t.equal(capitalize.words('1st place'), '1st Place') | ||
}) | ||
``` | ||
## Install | ||
@@ -113,0 +122,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6060
6
121