0.1.0 • Published 8 years ago

@cubitworx/string-polyfill v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

@cubitworx/string-polyfill

String polyfill methods for ECMAScript 6 specification & other usefull string manipulation

Implements

  • String.capitalise - Capitalise first letter of first word (all words) in input string
  • String.repeat - Repeat input string specified number of times

Install

npm install @cubitworx/string-polyfill

Usage

// String.capitalise
console.log( 'this is a test string'.capitalise() ); // This is a test string
console.log( 'this is a test string'.capitalise(true) ); // This Is A Test String
console.log( 'this-is-a-test-string'.capitalise(true,'-') ); // This-Is-A-Test-String

// String.repeat
console.log( 'x'.repeat(3) ); // xxx

Copyright and license

Code and documentation copyright 2016 Charles Louw. Code released under the MIT license.