🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

string-text-formatter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-text-formatter

Format string text for seo friendly url slug, seo friendly url slug with unique id, random string generator

1.0.6
latest
Source
npm
Version published
Weekly downloads
1
-93.75%
Maintainers
1
Weekly downloads
 
Created
Source

string-text-formatter

Format string text for seo friendly url slug, seo friendly url slug with unique id, random string generator

Install

$ npm install --save string-text-formatter	

Usage

import * as text from 'string-text-formatter';

// Remove all special characters and format string

const str = 'What is Lorem Ipsum?';

// Lower Case Method
const lowerCaseString = text.lowerCase(str);

console.log(lowerCaseString);
// what is lorem ipsum



// Upper case Method
const upperCaseString = text.upperCase(str);

console.log(upperCaseString);
// WHAT IS LOREM IPSUM



// Convert space using any character Method
const convertedString = text.convertString(str,'_');

console.log(convertedString);
// What_is_Lorem_Ipsum



// Seo friendly url slug method
const urlSlug = text.urlSlug(str);

console.log(convertedString);
// what-is-lorem-ipsum



// Seo friendly url slug with unique id method
const urlSlugUnqiue = text.urlSlugUnqiue(str);

console.log(urlSlugUnqiue);
// what-is-lorem-ipsum-1555935965905



// Generate random string method
// genetate alfhanumeric string

/**
 * @params
 * length: total string length (Default 8)
 * allowSpecialCharacters: true / false
*/

const string1 = text.randomString(12, false);

console.log(string1);
// xg7IqOAqo97v



const string2 = text.randomString(12, true);

console.log(string2);
// _HNu19-C^ohH

Keywords

format string text

FAQs

Package last updated on 27 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts