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

@agape/string

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agape/string - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

18

cjs/lib/string.d.ts

@@ -5,10 +5,10 @@ /**

*/
export declare function camelize(string?: string): string;
export declare function camelize(string: string): string;
/**
* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
export declare function tokenize(string?: string): string;
export declare function kebabify(string: string): string;
/**

@@ -19,3 +19,3 @@ * Returns a string formatted as spoken words. Adds spaces between words,

*/
export declare function verbalize(string?: string): string;
export declare function verbalize(string: string): string;
/**

@@ -26,9 +26,9 @@ * Returns a string formatted as a label. Adds spaces between words,

*/
export declare function labelize(string?: string): string;
export declare function labelize(string: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,
* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
export declare function classify(string?: string): string;
export declare function pascalize(string: string): string;
/**

@@ -41,3 +41,3 @@ * Formats a string in it's plural form. Most strings a returned

*/
export declare function pluralize(string?: string): string;
export declare function pluralize(string: string): string;
/**

@@ -59,2 +59,2 @@ * Format a number in units, pluralizing the units if there is more or less than

*/
export declare function titalize(string?: string): string;
export declare function titalize(string: string): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.titalize = exports.quanitfy = exports.pluralize = exports.classify = exports.labelize = exports.verbalize = exports.tokenize = exports.camelize = void 0;
exports.titalize = exports.quanitfy = exports.pluralize = exports.pascalize = exports.labelize = exports.verbalize = exports.kebabify = exports.camelize = void 0;
/**

@@ -9,3 +9,2 @@ * Returns a string formatted in camel case.

function camelize(string) {
string = string === undefined ? this : string;
return string

@@ -20,8 +19,7 @@ .replace(/[-_]/, ' ')

* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
function tokenize(string) {
string = string === undefined ? this : string;
function kebabify(string) {
return string

@@ -34,3 +32,3 @@ .replace(/[^A-Za-z0-9\s\-_]/g, '')

}
exports.tokenize = tokenize;
exports.kebabify = kebabify;
/**

@@ -42,3 +40,2 @@ * Returns a string formatted as spoken words. Adds spaces between words,

function verbalize(string) {
string = string === undefined ? this : string;
return string

@@ -57,3 +54,2 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

function labelize(string) {
string = string === undefined ? this : string;
return string

@@ -70,6 +66,5 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
function classify(string) {
string = string === undefined ? this : string;
function pascalize(string) {
return string

@@ -81,3 +76,3 @@ .replace(/[-_]/, ' ')

}
exports.classify = classify;
exports.pascalize = pascalize;
/**

@@ -91,11 +86,7 @@ * Formats a string in it's plural form. Most strings a returned

function pluralize(string) {
string = string === undefined ? this : string;
if (string.endsWith('y')) {
return string.replace(/y$/, 'ies');
}
else if (string.endsWith('us')) {
return string.replace(/us$/, 'i');
}
else if (string.endsWith('s')) {
return string;
return string + 'es';
}

@@ -132,3 +123,2 @@ else {

function titalize(string) {
string = string === undefined ? this : string;
return string

@@ -135,0 +125,0 @@ .replace(/(^|\s)([a-z])/g, (str, left, right) => { return left + right.toUpperCase(); })

@@ -5,10 +5,10 @@ /**

*/
export declare function camelize(string?: string): string;
export declare function camelize(string: string): string;
/**
* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
export declare function tokenize(string?: string): string;
export declare function kebabify(string: string): string;
/**

@@ -19,3 +19,3 @@ * Returns a string formatted as spoken words. Adds spaces between words,

*/
export declare function verbalize(string?: string): string;
export declare function verbalize(string: string): string;
/**

@@ -26,9 +26,9 @@ * Returns a string formatted as a label. Adds spaces between words,

*/
export declare function labelize(string?: string): string;
export declare function labelize(string: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,
* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
export declare function classify(string?: string): string;
export declare function pascalize(string: string): string;
/**

@@ -41,3 +41,3 @@ * Formats a string in it's plural form. Most strings a returned

*/
export declare function pluralize(string?: string): string;
export declare function pluralize(string: string): string;
/**

@@ -59,2 +59,2 @@ * Format a number in units, pluralizing the units if there is more or less than

*/
export declare function titalize(string?: string): string;
export declare function titalize(string: string): string;

@@ -6,3 +6,2 @@ /**

export function camelize(string) {
string = string === undefined ? this : string;
return string

@@ -16,8 +15,7 @@ .replace(/[-_]/, ' ')

* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
export function tokenize(string) {
string = string === undefined ? this : string;
export function kebabify(string) {
return string

@@ -36,3 +34,2 @@ .replace(/[^A-Za-z0-9\s\-_]/g, '')

export function verbalize(string) {
string = string === undefined ? this : string;
return string

@@ -50,3 +47,2 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

export function labelize(string) {
string = string === undefined ? this : string;
return string

@@ -62,6 +58,5 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
export function classify(string) {
string = string === undefined ? this : string;
export function pascalize(string) {
return string

@@ -81,11 +76,7 @@ .replace(/[-_]/, ' ')

export function pluralize(string) {
string = string === undefined ? this : string;
if (string.endsWith('y')) {
return string.replace(/y$/, 'ies');
}
else if (string.endsWith('us')) {
return string.replace(/us$/, 'i');
}
else if (string.endsWith('s')) {
return string;
return string + 'es';
}

@@ -120,3 +111,2 @@ else {

export function titalize(string) {
string = string === undefined ? this : string;
return string

@@ -123,0 +113,0 @@ .replace(/(^|\s)([a-z])/g, (str, left, right) => { return left + right.toUpperCase(); })

@@ -5,10 +5,10 @@ /**

*/
export declare function camelize(string?: string): string;
export declare function camelize(string: string): string;
/**
* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
export declare function tokenize(string?: string): string;
export declare function kebabify(string: string): string;
/**

@@ -19,3 +19,3 @@ * Returns a string formatted as spoken words. Adds spaces between words,

*/
export declare function verbalize(string?: string): string;
export declare function verbalize(string: string): string;
/**

@@ -26,9 +26,9 @@ * Returns a string formatted as a label. Adds spaces between words,

*/
export declare function labelize(string?: string): string;
export declare function labelize(string: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,
* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
export declare function classify(string?: string): string;
export declare function pascalize(string: string): string;
/**

@@ -41,3 +41,3 @@ * Formats a string in it's plural form. Most strings a returned

*/
export declare function pluralize(string?: string): string;
export declare function pluralize(string: string): string;
/**

@@ -59,2 +59,2 @@ * Format a number in units, pluralizing the units if there is more or less than

*/
export declare function titalize(string?: string): string;
export declare function titalize(string: string): string;

@@ -6,3 +6,2 @@ /**

export function camelize(string) {
string = string === undefined ? this : string;
return string

@@ -16,8 +15,7 @@ .replace(/[-_]/, ' ')

* Returns a string formatted as a token. Removes all symbols and replaces
* spaces and punctuation with dashes. AKA snake-case
* spaces and punctuation with dashes.
*
* @param string A string to be returned as a token
*/
export function tokenize(string) {
string = string === undefined ? this : string;
export function kebabify(string) {
return string

@@ -36,3 +34,2 @@ .replace(/[^A-Za-z0-9\s\-_]/g, '')

export function verbalize(string) {
string = string === undefined ? this : string;
return string

@@ -50,3 +47,2 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

export function labelize(string) {
string = string === undefined ? this : string;
return string

@@ -62,6 +58,5 @@ .replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })

* captializes the first letter of each word.
* @param string A string to be returned as a class name
* @param string A string to be returned in pascal case
*/
export function classify(string) {
string = string === undefined ? this : string;
export function pascalize(string) {
return string

@@ -81,11 +76,7 @@ .replace(/[-_]/, ' ')

export function pluralize(string) {
string = string === undefined ? this : string;
if (string.endsWith('y')) {
return string.replace(/y$/, 'ies');
}
else if (string.endsWith('us')) {
return string.replace(/us$/, 'i');
}
else if (string.endsWith('s')) {
return string;
return string + 'es';
}

@@ -120,3 +111,2 @@ else {

export function titalize(string) {
string = string === undefined ? this : string;
return string

@@ -123,0 +113,0 @@ .replace(/(^|\s)([a-z])/g, (str, left, right) => { return left + right.toUpperCase(); })

{
"name": "@agape/string",
"version": "1.2.0",
"version": "2.0.0",
"description": "String and token manipulation",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

@@ -10,6 +10,6 @@ # @agape/string

camelize,
classify,
kebabify,
pascalize,
pluralize,
titalize,
tokenize,
verbalize

@@ -20,4 +20,6 @@ } from '@agape/string'

classify('Foo bar') // FooBar
kebabify('Foo bar') // foo-bar
pascalize('Foo bar') // FooBar
pluralize('foo') // foos

@@ -27,4 +29,2 @@

tokenize('Foo bar') // foo-bar
verbalize('foo-bar') // Foo bar

@@ -43,4 +43,8 @@ ```

`classify`
`kebabify`
Converted to kebab-case: lower case, word boundaries replaced with dashes.
`pascalize`
Remove all symbols and spaces, captialize words.

@@ -50,4 +54,4 @@

Adds an 's' to most words. Words that end in 'y' are changed to 'ies',
words that end in 'us' are changed to 'i'.
Adds an 's' to most words. Words that end in 'y' are changed to 'ies'.
Words that end in s have 'es' appended to the word.

@@ -61,6 +65,2 @@ `titalize`

`tokenize`
Converted to lower case, word boundaries replaced with dashes.
`verbalize`

@@ -78,3 +78,3 @@

© 2020-2021 Maverik Minett
© 2020-2024 Maverik Minett

@@ -81,0 +81,0 @@ ## License

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

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

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