0.0.1 • Published 8 years ago

function-park v0.0.1

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

function-park

function-park is an common functions package for Nodejs。

Installation

npm install --save function-park

Usage

string.js

var S = require('function-park').string;
Function list
NameDescription
trimUsed for trimming whitespace
ltrimUsed for trimming whitespace at left
rtrimUsed for trimming whitespace at right
leftReturn part of a string from left
rightReturn part of a string from right
ucfirstUppercase the first character of a string
lcfirstLowercase the first character of a string
md5Calculate the md5 hash of a string
sha1Calculate the sha1 hash of a string
isEmailIs an email string or not
isIpIs an ip string or not
Example
var S = require('function-park').string;
var str = "My name is Nemo!";
console.log(S(str).lcfirst()); //print "my name is Nemo!"

Well, it's also can call these methods directly on native String. Just like this:

var S = require('function-park').string;
S.extendToString();
console.log("My name is Nemo!".lcfirst().ucfirst()); //print "My name is Nemo!"