sentence-case
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "sentence-case", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Sentence case a string", | ||
"main": "sentence-case.js", | ||
"files": [ | ||
"sentence-case.js", | ||
"vendor", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
"test": "istanbul cover _mocha -- -R spec", | ||
"build": "node build.js" | ||
"build": "node build.js", | ||
"stage-vendor": "git add vendor" | ||
}, | ||
"pre-commit": [ | ||
"build", | ||
"stage-vendor", | ||
"test" | ||
], | ||
"repository": { | ||
@@ -33,4 +44,8 @@ "type": "git", | ||
"mocha": "^1.18.2", | ||
"pre-commit": "0.0.9", | ||
"xregexp": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"lower-case": "^1.1.1" | ||
} | ||
} |
@@ -6,6 +6,7 @@ # Sentence Case | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![Gittip][gittip-image]][gittip-url] | ||
Sentence case a string, with full support for non-ASCII characters. Also handles non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will come out as an empty string. | ||
Sentence case a string. | ||
Supports Unicode (non-ASCII characters) and non-string entities, such as objects with a `toString` property, numbers and booleans. Empty values (`null` and `undefined`) will result in an empty string. | ||
## Installation | ||
@@ -39,3 +40,1 @@ | ||
[coveralls-url]: https://coveralls.io/r/blakeembrey/sentence-case?branch=master | ||
[gittip-image]: https://img.shields.io/gittip/blakeembrey.svg?style=flat | ||
[gittip-url]: https://www.gittip.com/blakeembrey |
@@ -1,5 +0,7 @@ | ||
var NON_WORD_REGEXP = require('./vendor/non-word-regexp.js'); | ||
var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp.js'); | ||
var TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp.js'); | ||
var lowerCase = require('lower-case'); | ||
var NON_WORD_REGEXP = require('./vendor/non-word-regexp'); | ||
var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp'); | ||
var TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp'); | ||
/** | ||
@@ -11,3 +13,3 @@ * Sentence case a string. | ||
*/ | ||
module.exports = function (str) { | ||
module.exports = function (str, locale) { | ||
if (str == null) { | ||
@@ -17,6 +19,6 @@ return ''; | ||
return String(str) | ||
// Enables camel case support. | ||
str = String(str) | ||
// Enable camel case support. | ||
.replace(CAMEL_CASE_REGEXP, '$1 $2') | ||
// Add a space after any digits. | ||
// Add a space after any digit groups. | ||
.replace(TRAILING_DIGIT_REGEXP, '$1 $2') | ||
@@ -26,5 +28,6 @@ // Remove all non-word characters and replace with a single space. | ||
// Trim whitespace around the string. | ||
.replace(/^ | $/g, '') | ||
// Finally lower case the entire string. | ||
.toLowerCase(); | ||
.replace(/^ | $/g, ''); | ||
// Lower case the entire string. | ||
return lowerCase(str, locale); | ||
}; |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
19448
1
5
7
26
39
+ Addedlower-case@^1.1.1
+ Addedlower-case@1.1.4(transitive)