You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@directus/format-title

Package Overview
Dependencies
Maintainers
2
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@directus/format-title - npm Package Compare versions

Comparing version

to
3.1.0

34

dist/format-title.es5.js

@@ -193,9 +193,2 @@ var prepositions = [

/**
* Convert prepositions and conjunctions to lowercase
* and special-case cased words
*
* @param {String} str String to process
* @returns {String} str Processed string
*/
function handleSpecialWords(str, index, words) {

@@ -224,16 +217,5 @@ var lowercaseStr = str.toLowerCase();

}
/**
* Add a space to the accumulator and add the string
*
* @param {String} acc The accumulator
* @param {String} str The string to paste after the acc value
* @returns {String} New accumulator
*/
function combine(acc, str) {
return acc + " " + str;
}
/**
* Capitalizes the first letter in the word
* @param word Word to capitalize
*/
function capitalize(word) {

@@ -248,17 +230,5 @@ return word.charAt(0).toUpperCase() + word.substring(1);

}
/**
* Formats a string to a "pretty" output
*
* @param {String} title The title to format
* @param {RegExp} separator=/|s|-|_/g
* @returns {String} The title formatted pretty
* @example
*
* const safeName = 'comment_metadata';
*
* const prettyName = formatTitle(safeName);
* // => 'Comment Metadata'
*/
function formatTitle(title, separator) {
if (separator === void 0) { separator = /\s|-|_/g; }
if (!separator)
separator = new RegExp('/\s|-|_| ', 'g');
return decamelize(title)

@@ -265,0 +235,0 @@ .split(separator)

@@ -199,9 +199,2 @@ (function (global, factory) {

/**
* Convert prepositions and conjunctions to lowercase
* and special-case cased words
*
* @param {String} str String to process
* @returns {String} str Processed string
*/
function handleSpecialWords(str, index, words) {

@@ -230,16 +223,5 @@ var lowercaseStr = str.toLowerCase();

}
/**
* Add a space to the accumulator and add the string
*
* @param {String} acc The accumulator
* @param {String} str The string to paste after the acc value
* @returns {String} New accumulator
*/
function combine(acc, str) {
return acc + " " + str;
}
/**
* Capitalizes the first letter in the word
* @param word Word to capitalize
*/
function capitalize(word) {

@@ -254,17 +236,5 @@ return word.charAt(0).toUpperCase() + word.substring(1);

}
/**
* Formats a string to a "pretty" output
*
* @param {String} title The title to format
* @param {RegExp} separator=/|s|-|_/g
* @returns {String} The title formatted pretty
* @example
*
* const safeName = 'comment_metadata';
*
* const prettyName = formatTitle(safeName);
* // => 'Comment Metadata'
*/
function formatTitle(title, separator) {
if (separator === void 0) { separator = /\s|-|_/g; }
if (!separator)
separator = new RegExp('/\s|-|_| ', 'g');
return decamelize(title)

@@ -271,0 +241,0 @@ .split(separator)

@@ -7,9 +7,2 @@ "use strict";

var special_case_1 = require("./special-case");
/**
* Convert prepositions and conjunctions to lowercase
* and special-case cased words
*
* @param {String} str String to process
* @returns {String} str Processed string
*/
function handleSpecialWords(str, index, words) {

@@ -38,16 +31,5 @@ var lowercaseStr = str.toLowerCase();

}
/**
* Add a space to the accumulator and add the string
*
* @param {String} acc The accumulator
* @param {String} str The string to paste after the acc value
* @returns {String} New accumulator
*/
function combine(acc, str) {
return acc + " " + str;
}
/**
* Capitalizes the first letter in the word
* @param word Word to capitalize
*/
function capitalize(word) {

@@ -62,17 +44,5 @@ return word.charAt(0).toUpperCase() + word.substring(1);

}
/**
* Formats a string to a "pretty" output
*
* @param {String} title The title to format
* @param {RegExp} separator=/|s|-|_/g
* @returns {String} The title formatted pretty
* @example
*
* const safeName = 'comment_metadata';
*
* const prettyName = formatTitle(safeName);
* // => 'Comment Metadata'
*/
function formatTitle(title, separator) {
if (separator === void 0) { separator = /\s|-|_/g; }
if (!separator)
separator = new RegExp('/\s|-|_| ', 'g');
return decamelize(title)

@@ -79,0 +49,0 @@ .split(separator)

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

/**
* Formats a string to a "pretty" output
*
* @param {String} title The title to format
* @param {RegExp} separator=/|s|-|_/g
* @returns {String} The title formatted pretty
* @example
*
* const safeName = 'comment_metadata';
*
* const prettyName = formatTitle(safeName);
* // => 'Comment Metadata'
*/
export default function formatTitle(title: string, separator?: RegExp): string;

2

package.json
{
"name": "@directus/format-title",
"version": "3.0.0",
"version": "3.1.0",
"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 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet