It's a project to create functions that are not in Javascript language like this:
var str = 'Cezar, Colar, Amar';
str.replaceAll('ar', 'bar');
Instalation:
bower install cp-functions --save
then:
<script src="bower_components/cp-functions/main.js"></script>
List of functions until now:
- String.replaceAll();
- String.ltrim();
- String.rtrim();
- Array.likeFilter();
String.replaceAll(search, replace) :
var str = 'Cezar, Colar, Amar';
str.replaceAll('ar', 'bar');
//Result: 'Cezbar, Colbar, Ambar'
String.ltrim() :
var str = ' Cezar';
str.ltrim();
//Result: 'Cezar'
String.rtrim() :
var str = 'Cezar ';
str.rtrim();
//Result: 'Cezar'
Array.likeFilter(nodeName, searchTerm) :
var arr = [
{name: 'Cezar'},
{name: 'André'},
{name: 'Eduardo'},
{name: 'Carlos'}
];
arr.likeFilter('name', 'cez');
//Result: [{name: 'Cezar'}]