Socket
Socket
Sign inDemoInstall

@agape/string

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.2.0

6

cjs/lib/string.d.ts

@@ -20,2 +20,8 @@ /**

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
export declare function labelize(string?: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -22,0 +28,0 @@ * captializes the first letter of each word.

21

cjs/lib/string.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.titalize = exports.quanitfy = exports.pluralize = exports.classify = exports.verbalize = exports.tokenize = exports.camelize = void 0;
exports.titalize = exports.quanitfy = exports.pluralize = exports.classify = exports.labelize = exports.verbalize = exports.tokenize = exports.camelize = void 0;
/**

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

.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')

@@ -48,2 +49,17 @@ .replace(/^([a-z])/, (str) => { return str.toUpperCase(); });

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
function labelize(string) {
string = string === undefined ? this : string;
return string
.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')
.toLocaleLowerCase()
.replace(/^([a-z])/, (str) => { return str.toUpperCase(); });
}
exports.labelize = labelize;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -77,2 +93,5 @@ * captializes the first letter of each word.

}
else if (string.endsWith('s')) {
return string;
}
else {

@@ -79,0 +98,0 @@ return string + 's';

@@ -20,2 +20,8 @@ /**

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
export declare function labelize(string?: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -22,0 +28,0 @@ * captializes the first letter of each word.

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

.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')

@@ -42,2 +43,16 @@ .replace(/^([a-z])/, (str) => { return str.toUpperCase(); });

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
export function labelize(string) {
string = string === undefined ? this : string;
return string
.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')
.toLocaleLowerCase()
.replace(/^([a-z])/, (str) => { return str.toUpperCase(); });
}
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -70,2 +85,5 @@ * captializes the first letter of each word.

}
else if (string.endsWith('s')) {
return string;
}
else {

@@ -72,0 +90,0 @@ return string + 's';

@@ -20,2 +20,8 @@ /**

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
export declare function labelize(string?: string): string;
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -22,0 +28,0 @@ * captializes the first letter of each word.

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

.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')

@@ -42,2 +43,16 @@ .replace(/^([a-z])/, (str) => { return str.toUpperCase(); });

/**
* Returns a string formatted as a label. Adds spaces between words,
* replacing underscores and hyphens, captilize the first word.
* @param string A string to be returned as spoken words
*/
export function labelize(string) {
string = string === undefined ? this : string;
return string
.replace(/(.)([A-Z][a-z]+)/g, (str, left, right) => { return left + ' ' + right; })
.replace(/([a-z0-9])([A-Z])/g, (str, left, right) => { return left + ' ' + right; })
.replace(/[-_]/, ' ')
.toLocaleLowerCase()
.replace(/^([a-z])/, (str) => { return str.toUpperCase(); });
}
/**
* Returns a string formatted as a class name. Removes all spaces and symbols,

@@ -70,2 +85,5 @@ * captializes the first letter of each word.

}
else if (string.endsWith('s')) {
return string;
}
else {

@@ -72,0 +90,0 @@ return string + 's';

12

package.json
{
"name": "@agape/string",
"version": "1.1.2",
"version": "1.2.0",
"description": "String and token manipulation",
"main": "./cjs/index.js",
"module": "./es2020/index.js",
"keywords": [
"agape",
"object",
"traits"
"string"
],
"author": "Maverik Minett",
"license": "MIT",
"dependencies": {
"reflect-metadata": "^0.1.13"
},
"es2020": "./esm2020/index.js",

@@ -27,5 +24,6 @@ "es2015": "./esm2015/index.js",

"default": "./es2020/index.js",
"require": "./cjs/index.js"
"require": "./cjs/index.js",
"import": "./es2020/index.js"
}
}
}

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc