@directus/format-title
Advanced tools
Comparing version 1.1.0 to 1.1.1
12
index.js
@@ -15,6 +15,12 @@ const decamelize = require('decamelize'); | ||
*/ | ||
function handleSpecialWords(str) { | ||
function handleSpecialWords(str, index) { | ||
const lowercaseStr = str.toLowerCase(); | ||
const uppercaseStr = str.toUpperCase(); | ||
for (let i = 0; i < specialCase.length; i += 1) { | ||
if (specialCase[i].toLowerCase() === lowercaseStr) return specialCase[i]; | ||
} | ||
if (index === 0) return str; | ||
if (prepositions.includes(lowercaseStr)) return lowercaseStr; | ||
@@ -24,6 +30,2 @@ if (conjunctions.includes(lowercaseStr)) return lowercaseStr; | ||
for (let i = 0; i < specialCase.length; i += 1) { | ||
if (specialCase[i].toLowerCase() === lowercaseStr) return specialCase[i]; | ||
} | ||
return str; | ||
@@ -30,0 +32,0 @@ } |
{ | ||
"name": "@directus/format-title", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Custom string formatter that converts any string into [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
6197
77