Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sentence-case

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sentence-case - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

19

package.json
{
"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"
}
}

7

README.md

@@ -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);
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc