New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@reverse/string

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reverse/string

Useful functions for modifying and managing strings.

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
2
Created
Source

@reverse/string

Useful functions for modifying and managing strings.

You can install with nodejs and npm

npm i @reverse/string

Table of Contents

  • capitalize
  • format
  • isValidEmail

capitalize(string)

Capitalizes the first letter of a string.

Parameters

  • string: String: The string to modify.

Example

import { capitalize } from '@reverse/string';

capitalize('hello');
// "Hello"

capitalize('123abc');
// "123abc"

format(format, ...variables)

Formats a string by substituting variables.

Parameters

  • format: String: The string to format.
  • ...variables: Any: Any variables to substitute in the string.

Example

import { format } from '@reverse/string';

format('Hello $1.', 'World');
// "Hello World."

format('I like $2 and $1.', 'cats', 'dogs');
// "I like dogs and cats."

isValidEmail(email)

Checks if a email is a valid formatted email.

Paramerters

  • email: String: The email to check.

Example

import { isValidEmail } from '@reverse/string';

isValidEmail('example@example.com');
// true

isValidEmail('ample.com');
// false

plural(number, word)

Makes a word plural if the number is not one.

Parameters

  • number: number: The amount of that object.
  • word: string: The word to plural-ize.

Example

import { plural } from '@reverse/string';

plural(0, 'Dog');
// Dogs

plural(1, 'Dog');
// Dog

plural(10, 'Dog');
// Dogs

Keywords

string

FAQs

Package last updated on 27 Dec 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