Members
Methods
# aesDecrypt(encrypted, key)
AES decrypt
Parameters:
Name | Type | Description |
---|---|---|
encrypted |
||
key |
- See:
-
- /src/shim/Cipher.php
# aesEncrypt(text, key)
AES encrypt
Parameters:
Name | Type | Description |
---|---|---|
text |
||
key |
- See:
-
- /src/shim/Cipher.php
# ajaxRun(method)
ajax request one by one
Parameters:
Name | Type | Description |
---|---|---|
method |
POST, GET, HEAD, DELETE, OPTIONS, PATCH, PROPATCH |
- To Do:
-
- scheduling any jquery ajax
# analys(event_action, event_label, event_category, event_value, event_callback)
Google analystic reporter
Parameters:
Name | Type | Description |
---|---|---|
event_action |
String | |
event_label |
string | |
event_category |
string | |
event_value |
string | |
event_callback |
function | any |
# array_rand(arrays, unique)
pick random from array
Parameters:
Name | Type | Description |
---|---|---|
arrays |
Array.<any> | |
unique |
boolean | Unique the arrays |
# array_remove(source, target)
Remove source sub elements array if exists in target array
// If I have this array:
var myArray = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
// and this one:
var toRemove = ['b', 'c', 'g'];
console.log(array_remove(myArray, toRemove)); // => ['a', 'd', 'e', 'f']
Parameters:
Name | Type | Description |
---|---|---|
source |
||
target |
# array_shuffle(a)
Shuffles array in place.
Parameters:
Name | Type | Description |
---|---|---|
a |
items An array containing the items. |
# async_exec(commands, callback)
Async execute commands
Parameters:
Name | Type | Description |
---|---|---|
commands |
||
callback |
callback for each command return |
# async_process(source_cache)
process page asynchronously
Parameters:
Name | Type | Description |
---|---|---|
source_cache |
url |
# autoExpand(field)
Automatically expand a textarea as the user types (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
Parameters:
Name | Type | Description |
---|---|---|
field |
The textarea |
# binl2rstr(input) → {string}
Convert an array of little-endian words to a string
Parameters:
Name | Type | Description |
---|---|---|
input |
Array.<number> | MD5 Array |
MD5 string
# binlMD5(x, len) → {Array.<number>}
Calculate the MD5 of an array of little-endian words, and a bit length.
Parameters:
Name | Type | Description |
---|---|---|
x |
Array | Array of little-endian words |
len |
number | Bit length |
MD5 Array
# bitRotateLeft(num, cnt) → {number}
Bitwise rotate a 32-bit number to the left.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | 32-bit number |
cnt |
number | Rotation count |
Rotated number
# call_user_func(functionName, context, args)
call_user_func
Parameters:
Name | Type | Description |
---|---|---|
functionName |
||
context |
||
args |
# compileAssets(item)
compile and minify assets
Parameters:
Name | Type | Description |
---|---|---|
item |
file full path |
# createAlert(title, summary, details, severity, dismissible, autoDismiss, options)
Bootstrap Alert Generator
Parameters:
Name | Type | Description |
---|---|---|
title |
||
summary |
||
details |
||
severity |
||
dismissible |
||
autoDismiss |
||
options |
Example
createAlert(
"[title] Opps!",
"[description] Something went wrong",
"[details] Here is a bunch of text about some stuff that happened.",
"[mode|bg-color] danger",
true, false,
{ position: "fixed", bottom: "15px", right: "15px" });
# createApp(withoutView)
Create App.js
Parameters:
Name | Type | Description |
---|---|---|
withoutView |
false to not compile views javascripts |
# createStyle(css)
Create style css dynamic
Parameters:
Name | Type | Description |
---|---|---|
css |
Examples
css = 'h1 { background: red; }'
arributes = {id: 'customStyle', media: 'all'}
# datatables_colums_options(data, exclude)
Optimize Datatables Columns Options
Parameters:
Name | Type | Description |
---|---|---|
data |
||
exclude |
# datatables_optimize(id, callback)
Optimize Material Datatables
Parameters:
Name | Type | Description |
---|---|---|
id |
id table |
|
callback |
additional function to optimizer |
# deepAssign(…objects)
Deep merge two or more objects into the first. (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
objects |
<repeatable> |
The objects to merge together |
Merged values of defaults and options
# doc(cb)
Better-Docs JSDoc
\\.(jsx|js|ts|tsx|js(doc|x)?)$
Parameters:
Name | Type | Description |
---|---|---|
cb |
function callback |
# execute(cmds, callback)
Execute command schedule
Parameters:
Name | Type | Description |
---|---|---|
cmds |
||
callback |
- module:NodeJS
# findDups(arr, callback)
find duplicate array
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<any> | |
callback |
function |
# foreach(object, callback)
Loop key value of object
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | |
callback |
function |
# formsaver(show_debug)
Set all forms to be saved with method vanilla
Parameters:
Name | Type | Default | Description |
---|---|---|---|
show_debug |
false | debug process saving and restoration |
- To Do:
-
- save input fields into browser for reusable form
# generateRandomString(length)
Generate random string with length
Parameters:
Name | Type | Default | Description |
---|---|---|---|
length |
6 | length to generate |
# getCheckedValue(el)
this will check the checked radio in a group, and return the value
Parameters:
Name | Type | Description |
---|---|---|
el |
Example
var checkedbooking = getCheckedValue(document.getElementsByName('booking_type'));
console.log(checkedbooking); // {index: NumberIndexRadio, value: valueOfRadio}
# getParameterByName(name, url)
get url parameter by name
Parameters:
Name | Type | Default | Description |
---|---|---|---|
name |
parameter name |
||
url |
null | url target, null for current location.href |
Example
```js
// query string: ?foo=lorem&bar=&baz
var foo = getParameterByName('foo'); // "lorem"
var bar = getParameterByName('bar'); // "" (present with empty value)
var baz = getParameterByName('baz'); // "" (present with no value)
var qux = getParameterByName('qux'); // null (absent)
```
# getRandom(arr, n, callback)
Get multiple random element from array
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<any> | array sources |
n |
Number | maximum element to be in result |
callback |
function | function to process result |
# hexHMACMD5(k, d) → {string}
Calculates the Hex encoded HMAC-MD5 for the given key and data
Parameters:
Name | Type | Description |
---|---|---|
k |
string | HMAC key |
d |
string | Input string |
Raw MD5 string
# hexMD5(s) → {string}
Encodes input string as Hex encoded string
Parameters:
Name | Type | Description |
---|---|---|
s |
string | Input string |
Hex encoded string
# in_array(needle, haystack)
in_array PHP equivalent
Parameters:
Name | Type | Description |
---|---|---|
needle |
string etc |
|
haystack |
# inArray(needle, haystack)
in_array PHP equivalent
Parameters:
Name | Type | Description |
---|---|---|
needle |
string etc |
|
haystack |
# jAjax(settings)
default ajax jquery request with unique ID
Parameters:
Name | Type | Description |
---|---|---|
settings |
Jquery ajax settings |
# JavaScriptCaller(url, callback)
Javascript caller
Parameters:
Name | Type | Description |
---|---|---|
url |
String | |
callback |
function |
# list_package()
Get list packages and fetch latest version
# load_disqus(disqus_shortname)
Disqus loader which verifies the existence of #disqus_thread
on
the web page and then prepares the disqus embed script to hook in
the document
Parameters:
Name | Type | Description |
---|---|---|
disqus_shortname |
disqus username/shortname |
# load_module(name, callback)
Load Modules From node_modules folder
Parameters:
Name | Type | Description |
---|---|---|
name |
||
callback |
# loadCodeMirrorScript(opt)
CodeMirror script and style loader
Parameters:
Name | Type | Description |
---|---|---|
opt |
# loadingio(text, callback, mode)
Loading.io
Parameters:
Name | Type | Description |
---|---|---|
text |
string | |
callback |
function | |
mode |
"enable" | "enabled" | "disable" | "disabled" |
# LoadScript(urls, callback)
Load script asynchronously
Parameters:
Name | Type | Description |
---|---|---|
urls |
||
callback |
# makeid(length)
unique id generator
Parameters:
Name | Type | Description |
---|---|---|
length |
digit number string |
random string
# md5(string, keyopt, rawopt) → {string}
Calculates MD5 value for a given string. If a key is provided, calculates the HMAC-MD5 value. Returns a Hex encoded string unless the raw argument is given.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
string |
string | Input string |
|
key |
string |
<optional> |
HMAC key |
raw |
boolean |
<optional> |
Raw output switch |
MD5 output
# md5cmn(q, a, b, x, s, t) → {number}
Basic operation the algorithm uses.
Parameters:
Name | Type | Description |
---|---|---|
q |
number | q |
a |
number | a |
b |
number | b |
x |
number | x |
s |
number | s |
t |
number | t |
Result
# md5ff(a, b, c, d, x, s, t) → {number}
Basic operation the algorithm uses.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | a |
b |
number | b |
c |
number | c |
d |
number | d |
x |
number | x |
s |
number | s |
t |
number | t |
Result
# md5gg(a, b, c, d, x, s, t) → {number}
Basic operation the algorithm uses.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | a |
b |
number | b |
c |
number | c |
d |
number | d |
x |
number | x |
s |
number | s |
t |
number | t |
Result
# md5hh(a, b, c, d, x, s, t) → {number}
Basic operation the algorithm uses.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | a |
b |
number | b |
c |
number | c |
d |
number | d |
x |
number | x |
s |
number | s |
t |
number | t |
Result
# md5ii(a, b, c, d, x, s, t) → {number}
Basic operation the algorithm uses.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | a |
b |
number | b |
c |
number | c |
d |
number | d |
x |
number | x |
s |
number | s |
t |
number | t |
Result
# module_exists(tmodule)
check if module exists
Parameters:
Name | Type | Description |
---|---|---|
tmodule |
- module:node
# object_join(obj)
Join object to separated string
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
Joined string
# oddoreven(n, type)
Odd or Even (Ganjil Genap);
Parameters:
Name | Type | Description |
---|---|---|
n |
||
type |
odd or even |
# onlyUnique(value, index, self)
Get unique array
Parameters:
Name | Type | Description |
---|---|---|
value |
any | |
index |
any | |
self |
Array.<any> |
Example
dataArray.filter(onlyUnique)
# pagination_up(target)
Scroll up after click pagination dt
Parameters:
Name | Type | Description |
---|---|---|
target |
# parse_proxy(str) → {Array.<any>}
parse proxy from string
Parameters:
Name | Type | Description |
---|---|---|
str |
string |
proxy list filtered
# parseNumber(total_amount_string)
Parse string to float/number
Parameters:
Name | Type | Description |
---|---|---|
total_amount_string |
string including numbers |
# parsePackageString(packageString) → {PackageInfo}
Parses the given package string into a package name and version
Parameters:
Name | Type | Description |
---|---|---|
packageString |
string | a string representing a package name and version (e.g. package@1.0.0) |
- an object containing the package name and package version
# prepEntities(str)
Encode HTML string to HTML entities
Parameters:
Name | Type | Description |
---|---|---|
str |
String |
# Queue()
Creates a new queue. A queue is a first-in-first-out (FIFO) data structure - items are added to the end of the queue and removed from the front.
Example
// create a new queue
var queue = new Queue();
// enqueue an item
queue.enqueue('item');
// dequeue an item
var item = queue.dequeue();
// get the item at the front of the queue
var item = queue.peek();
// determine the number of items in the queue
var length = queue.getLength();
// determine whether the queue is empty
var isEmpty = queue.isEmpty();
# rawHMACMD5(k, d) → {string}
Calculates the raw HMAC-MD5 for the given key and data
Parameters:
Name | Type | Description |
---|---|---|
k |
string | HMAC key |
d |
string | Input string |
Raw MD5 string
# rawMD5(s) → {string}
Encodes input string as raw MD5 string
Parameters:
Name | Type | Description |
---|---|---|
s |
string | Input string |
Raw MD5 string
# resizeIFrameToFitContent(iFrame)
Resize iframe to fit content
Parameters:
Name | Type | Description |
---|---|---|
iFrame |
# rstr2binl(input) → {Array.<number>}
Convert a raw string to an array of little-endian words Characters >255 have their high-byte silently ignored.
Parameters:
Name | Type | Description |
---|---|---|
input |
string | Raw input string |
Array of little-endian words
# rstr2hex(input) → {string}
Convert a raw string to a hex string
Parameters:
Name | Type | Description |
---|---|---|
input |
string | Raw input string |
Hex encoded string
# rstrHMACMD5(key, data) → {string}
Calculates the HMAC-MD5 of a key and some data (raw strings)
Parameters:
Name | Type | Description |
---|---|---|
key |
string | HMAC key |
data |
string | Raw input string |
Raw MD5 string
# rstrMD5(s) → {string}
Calculate the MD5 of a raw string
Parameters:
Name | Type | Description |
---|---|---|
s |
string | Input string |
Raw MD5 string
# safeAdd(x, y) → {number}
Add integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in interpreters.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | First integer |
y |
number | Second integer |
Sum
# select2Country(selectCountry, select2Opt)
Select2 Country
Parameters:
Name | Type | Description |
---|---|---|
selectCountry |
||
select2Opt |
Select2 Options |
- module:jQuery
Example
select2Country($("#selectID"), {placeholder:"Select Your Country"})
# serializeArray(form)
Serialize all form data into an array of key/value pairs (c) 2020 Chris Ferdinandi, MIT License, https://gomakethings.com
Parameters:
Name | Type | Description |
---|---|---|
form |
The form to serialize |
The serialized form data
Example
var form = document.querySelector('#FormID');
var data = serializeArray(form);
console.log(data);
# serializeArray2Object(obj)
Transform serializeArray
into object key value
Parameters:
Name | Type | Description |
---|---|---|
obj |
# setEventListener(element, eventNames, listener)
Add one or more listeners to an element
Parameters:
Name | Type | Description |
---|---|---|
element |
DOM element to add listeners to |
|
eventNames |
space separated list of event names, e.g. 'click change' |
|
listener |
function to attach for each event as a listener |
# shuffle(array)
PHP shuffle array equivalent
Parameters:
Name | Type | Description |
---|---|---|
array |
Example
var arr = [2, 11, 37, 42];
shuffle(arr);
console.log(arr); //return random
# single_tsCompile(target)
Single Typescript Compiler
Parameters:
Name | Type | Description |
---|---|---|
target |
- To Do:
-
- universal-framework typescript compiler support
# str2rstrUTF8(input) → {string}
Encode a string as UTF-8
Parameters:
Name | Type | Description |
---|---|---|
input |
string | Input string |
UTF8 string
# toogleClass(element, className)
Add class if not exists
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | element from DOM |
className |
string | class name |
# trueTypeOf(obj) → {String}
More accurately check the type of a JavaScript object (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | The object |
The object type
# typescriptCompiler(source, destination, callback)
Typescript compiler
Parameters:
Name | Type | Description |
---|---|---|
source |
||
destination |
||
callback |
# uniqid(prefix, suffix)
Create uniqueid with prefix or suffix
Parameters:
Name | Type | Description |
---|---|---|
prefix |
||
suffix |
# userJSDecrypt(passphrase, encryptedText)
Decrypt function
Parameters:
Name | Type | Description |
---|---|---|
passphrase |
string | |
encryptedText |
string |
# userJSEncrypt(passphrase, plainText)
Encrypt function
Parameters:
Name | Type | Description |
---|---|---|
passphrase |
string | |
plainText |
string |
# writeFile(path, contents, cb)
Write file recursive
Parameters:
Name | Type | Description |
---|---|---|
path |
||
contents |
||
cb |
Type Definitions
# ElementTagNameMap
- Deprecated:
- Directly use HTMLElementTagNameMap or SVGElementTagNameMap as appropriate, instead.