jp-string

1.2.1 • Public • Published

jpString

A string manipulation NPM package. Designed to allow for various string alterations in javascript.

Contents

  1. Installation & Usage
  2. Docs

Installation & Usage

Install the package with npm

npm i jp-string

Import the package to your file

const jpString = require("jpString");

Use the function you need by accessing it through the jpString object

jpString.randomUpperLetter();

Docs

randomUpperLetter

Usage:

jpString.randomUpperLetter();
// possible return "A"

It takes in no arguments.

When called it returns one random letter from the English alphabet (ABCDEFGHIJKLMNOPQRSTUVWXYZ) in upper (capital) case.

randomLowerLetter

Usage:

jpString.randomLowerLetter();
// possible return "b"

It takes in no arguments.

When called it returns one random letter from the English alphabet (abcdefghijklmnopqrstuvwxyz) in lower case.

initial

Usage:

jpString.initial(string, capital);

It takes in two arguments; a string of any length and a boolean.

If capital is set to true every initial will be capitalized. If capital is set to false every initial will be set to lower case. If there is no second argument the initials will be returned in the case of their submission.

The first argument HAS to be a string.

It returns the initials of each word that is separated by a space. The initials are returned joined. Special characters such as £$%^ are ignored but numbers are returned. Commas (,) and periods (.) that are not spaced will be returned within the initials.

Example:

jpString.initial("john smith");
// will return unchanged initials 'js'
jpString.initial("john Smith", true);
// will return capitalized initials 'JS'
jpString.initial("John Smith. Mary Jane", false);
// will return lower case initials with periods 'js.mj'
// this is also true with commas
jpString.initial("$£John Smith , Mary 1Jane");
// will return unchanged initials without the comma or $£ 'JSM1'
// this is also true with periods

Readme

Keywords

Package Sidebar

Install

npm i jp-string

Weekly Downloads

0

Version

1.2.1

License

ISC

Unpacked Size

10.2 kB

Total Files

12

Last publish

Collaborators

  • joshpattison