Skip to content

tbaraza/String-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Codacy Badge

String-Class Extension

This is an extension of the inbuilt String class. Basically it adds other methods to this class.The methods' execution is similar to the normal String class methods. The extension has been implemented using javascript prototypes concept.


#Usage

Running on Node

  • Get the node environment $ node
  • Require the source file > require('./src/string-class.js')
  • Use the various methods as specified in the featured methods example

Running the tests

  • On your terminal change directory to the root project folder.
  • Run $ npm test

Featured methods

hasVowels

let try1 = 'toni'.hasVowels() // returns true
let try2 = 'rtty'.hasVowels() // returns false

toUpper

let try1 = 'toni'.toUpper() // returns 'TONI'
let try2 = 'My day'.toUpper() // returns 'MY DAY'

toLower

let try1 = 'LORD'.toLower() // returns 'lord'
let try2 = '#1FBI Investigates'.toLower() // returns '#1fbi Investigates'

ucFirst

let try1 = 'toni'.ucFirst() // returns 'Toni'
let try2 = '33street'.ucFirst() // returns '33street'

isQuestion

let try1 = 'toni?'.isQuestion() // returns true
let try2 = 'rtty'.isQuestion() // returns false

words

let try1 = 'true, love'.words() returns // ['true', 'love']
let try2 = 'forget'.words() returns // ['forget']

wordCount

let try1 = 'God, is good'.wordCount() // returns 3
let try2 = 'yeah'.wordCount() // returns 1

toCurrency

let try1 = '12387'.toCurrency() // returns '12,387.00'
let try2 = '34'.toCurrency() // returns '34.00'

fromCurrency

let try1 = '5,673,392'.fromCurrency() // returns 5673392
let try2 = '4,696.56'.fromCurrency() // returns 4696.56

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published