Skip to content
/ moldjs Public

JavaScript String expanded 🎉

Notifications You must be signed in to change notification settings

juhoen/moldjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoldJS - JavaScript String expanded

The goal of the MoldJS project is to expand JavaScript string functionality by providing powerful shortcut methods. MoldJS expands String prototype keeping string manipulation simple. MoldJS is light-weight and has zero dependencies.

Documentation

Documentation can be found by clicking here.

Some examples

Simple formatting

"{} world!".format("Hello");                           // => "Hello world"
"rbg({r}, {g}, {b})".format({ r: 10, g: 20, b: 20 });  // => "rbg(10, 20, 30);"

String manipulation

"hello world".titleCase();  // => "Hello World"
"hello world".camelCase();  // => "helloWorld"
"hello world".capitalize(); // => "Hello world"

Splitting

"Hello, world!".parts(); // => ["Hello,", "world!"]
"Hello, world!".words(); // => ["Hello", "world"]

Other

"Text with email address [email protected]".linkify();
// => 'Text with email address <a href="mailto:[email protected]">[email protected]</a>'

"Text with link https://enala.co".linkify();
// => 'Text with link <a href="https://enala.co" target="_blank">https://enala.co</a>'

'<div class="sample"><p>This is <b>text</b>!</p></div>'.stripTags();
// => "This is text!"