Quick Start
How to quickly get up and runnding with Faze.js
Then include Faze the head of your html file with the tag below
<script type="text/javascript" src="path/to/faze.min.js"></script>
Basic Usage
Faze( 'selector' );
fz( 'selector' );
This returns the selected element as a faze object with the ability to execute transforms and helper functions.
You can also pass Faze an array object or css selector
// array
fz( [ 12, 13, 14 ] );
// object
fz( { foo: "baz" } );
API
Here you will find the complete list of functions and parameters, you can also visit here to view the generated api's
Faze(); - fz();
Categories: core
Return a Faze object collection of matched DOM base elements or a Faze object collection of an Object or Array
Contents:
- Faze( selector [, context ] )
- Faze( selector [, context ] )
- Faze( DOMElelemt )
- Faze( Array )
- Faze( Object )
- Faze()
Examples
Faze( 'div.foo' );
Faze( 'div.foo', document );
Faze( [ 11, 12, 13 ] );
Faze( { foo: "baze" } );
String functions
Trim
Categories: string
Will remove all white space from a string
Example
fz().trim( 'staqwrefg aWERFAQWERG' );
// outputs 'staqwrefg aWERFAQWERG'
byteSize
Categories: string
Will remove all white space from a string
Example
fz().trim( 'staqwrefg aWERFAQWERG' );
// outputs 'staqwrefg aWERFAQWERG'
capitalize
Categories: string
will capitalise first letter of string and turn the rest to lower case unless the second argument is explicitly false
Example
fz().capitalise( 'staqwrefg aWERFAQWERG' );
// outputs 'Staqwrefg awerfaqwerg'
fz().capitalise( 'staqwrefg aWERFAQWERG', false );
// outputs 'Staqwrefg aWERFAQWERG'
capitalizeWords
Categories: string
will capitalise first letter of every word in the string and turn the rest to lowercase
Example
fz().capitalizeWords( 'staqwrefg aWERFAQWERG' );
// outputs 'Staqwrefg Awerfaqwerg'
deCapitalize
Categories: string
will return a string minus capitalised first letter of every word in the string and turn the rest to lowercase, if second argument true rest of string will be uppercased
Example
fz().deCapitalize( 'Staqwrefg aWERFAQWERG' );
// outputs 'staqwrefg aWERFAQWERG'
fz().deCapitalize( 'Staqwrefg aWERFAQWERG', true );
// outputs 'sTAQWREFG AWERFAQWERG'
escapeHTML
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().escapeHTML( '<div></div>' );
// outputs "&\lt;div&\gt;&\lt;/div&\gt;"
fromCamelCase
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().fromCamelCase( 'fromCamelCase' );
// outputs "from Camel Case";
fz().fromCamelCase( 'fromCamelCase', '-' );
// outputs "from-Camel-Case";
isAnagram
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().isAnagram( 'Jim Morrison', 'Mr Mojo Risin' );
// outputs true
fz().isAnagram( 'fromCamelCase', 'Mr Mojo Risin' );
// outputs false
isLowerCase
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().isLowerCase( 'JIMMO' );
// outputs false
fz().isLowerCase( 'something' );
// outputs true
isUpperCase
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().isUpperCase( 'JIM' );
// outputs true
fz().isUpperCase( 'something' );
// outputs false
mapString
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().mapString( 'JIM', function( character, index, string ) {
// manipulate character and return to change it
return character.toLowerCase();
});
//returns 'jim';
mask
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().mask( 'testing', 3, '*' );
// returns "****ing"
fz().mask( 'testing', 1, '-' );
// returns "------g"
pad
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().pad( 'testing', 11, ' ' );
// returns " testing "
removeNonASCII
Categories: string
Will return true of false depending on the validity of the CSV string
Example
fz().removeNonASCII( 'testing¡' );
// returns "testing"
Array functions
isArray
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().isArray( [] );
// returns true
fz( [ 42, 42, 42 ] ).isArray();
// returns true
fz( { foo: "bar" } ).isArray();
// returns false
inArray
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().inArray( 12, [ 12 ] );
// returns true
fz( [ 42, 42, 42 ] ).inArray( 42 );
// returns true
fz( [ 'string', 12 ] ).inArray( 42 );
// returns false
merge
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().merge( [ 12 ], [ 12 ] );
// returns [ 12, 12 ]
makeArray
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().makeArray( [ 12 ], [ 12 ] );
// returns [ 12, 12 ]
sort
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().sort( [ 'b', 'c', 'a' ] );
// returns [ 'a', 'b', 'c' ];
random
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().random( [ 'b', 'c', 'a' ] );
// returns random between 'a', 'b' and 'c';
fz( [ 'b', 'c', 'a' ] ).random();
// returns random between 'a', 'b' and 'c';
flattenArray
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz().flattenArray( [[ 'b', 'c', 'a' ]] );
// returns [ 'a', 'b', 'c' ]
all
Categories: Array
Will return true of false depending on the validity of the CSV string
Example
fz( [ 1, 2, 3 ] ).all( function( ) {
return this + 1;
});
// returns [ 2, 3, 4 ]