Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

cezarpretto/cp-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

CP FUNCTIONS

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();

Examples

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'}]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published