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

title-case

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

title-case - npm Package Compare versions

Comparing version 3.0.3 to 4.0.0

2

dist/index.d.ts

@@ -1,1 +0,1 @@

export declare function titleCase(input: string): string;
export declare function titleCase(input: string, locale?: string[] | string): string;

@@ -1,15 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.titleCase = void 0;
var SMALL_WORDS = /\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i;
var TOKENS = /[^\s:–—-]+|./g;
var WHITESPACE = /\s/;
var IS_MANUAL_CASE = /.(?=[A-Z]|\..)/;
var ALPHANUMERIC_PATTERN = /[A-Za-z0-9\u00C0-\u00FF]/;
function titleCase(input) {
var result = "";
var m;
const SMALL_WORDS = /\b(?:an?d?|a[st]|because|but|by|en|for|i[fn]|neither|nor|o[fnr]|only|over|per|so|some|tha[tn]|the|to|up|upon|vs?\.?|versus|via|when|with|without|yet)\b/i;
const TOKENS = /[^\s:–—-]+|./g;
const WHITESPACE = /\s/;
const IS_MANUAL_CASE = /.(?=[\p{Lu}]|\..)/u;
const ALPHANUMERIC_PATTERN = /[\p{Lu}\p{Ll}\d]/u;
export function titleCase(input, locale) {
let result = "";
let m;
// tslint:disable-next-line
while ((m = TOKENS.exec(input)) !== null) {
var token = m[0], index = m.index;
const { 0: token, index } = m;
if (

@@ -26,3 +23,3 @@ // Ignore already capitalized words.

// Find and uppercase first word character, skips over *modifiers*.
result += token.replace(ALPHANUMERIC_PATTERN, function (m) { return m.toUpperCase(); });
result += token.replace(ALPHANUMERIC_PATTERN, (m) => m.toLocaleUpperCase(locale));
continue;

@@ -34,3 +31,2 @@ }

}
exports.titleCase = titleCase;
//# sourceMappingURL=index.js.map
{
"name": "title-case",
"version": "3.0.3",
"version": "4.0.0",
"description": "Transform a string into title case following English rules",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"module": "dist.es2015/index.js",
"sideEffects": false,
"jsnext:main": "dist.es2015/index.js",
"type": "module",
"files": [
"dist/",
"dist.es2015/",
"LICENSE"
"dist/"
],
"exports": {
".": "./dist/index.js"
},
"scripts": {
"lint": "tslint \"src/**/*\" --project tsconfig.json",
"build": "rimraf dist/ dist.es2015/ && tsc && tsc -P tsconfig.es2015.json",
"specs": "jest --coverage",
"test": "npm run build && npm run lint && npm run specs",
"size": "size-limit",
"prepare": "npm run build"
"format": "ts-scripts format",
"specs": "ts-scripts specs",
"test": "ts-scripts test",
"build": "ts-scripts build",
"bench": "vitest bench",
"prepublishOnly": "npm run build"
},

@@ -46,44 +43,5 @@ "repository": {

"homepage": "https://github.com/blakeembrey/change-case/tree/master/packages/title-case#readme",
"size-limit": [
{
"path": "dist/index.js",
"limit": "350 B"
}
],
"jest": {
"roots": [
"<rootDir>/src/"
],
"transform": {
"\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@size-limit/preset-small-lib": "^2.2.1",
"@types/jest": "^24.0.23",
"@types/node": "^12.12.14",
"jest": "^24.9.0",
"rimraf": "^3.0.0",
"ts-jest": "^24.2.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"typescript": "^4.1.2"
},
"dependencies": {
"tslib": "^2.0.3"
},
"gitHead": "76a21a7f6f2a226521ef6abd345ff309cbd01fb0"
}
}
# Title Case
[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Bundle size][bundlephobia-image]][bundlephobia-url]
> Transform a string into [title case](https://en.wikipedia.org/wiki/Letter_case#Title_case) following English rules.

@@ -27,8 +23,1 @@

MIT
[npm-image]: https://img.shields.io/npm/v/title-case.svg?style=flat
[npm-url]: https://npmjs.org/package/title-case
[downloads-image]: https://img.shields.io/npm/dm/title-case.svg?style=flat
[downloads-url]: https://npmjs.org/package/title-case
[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/title-case.svg
[bundlephobia-url]: https://bundlephobia.com/result?p=title-case

Sorry, the diff of this file is not supported yet

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