~lastrosade/jdjs

Jeremy Does JavaScript
Fixed code, added functions, fixed doc

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~lastrosade/jdjs
read/write
git@git.sr.ht:~lastrosade/jdjs

You can also use your local clone with git send-email.

#Jeremy Does JS

A simple js lib

#Arrays


arrify

arrify(Any x): Array<Any>

Make anything into an array except arrays


alast

alast(Array ar): Any

Get last element of array ar


apos

apos(Any x, Array ar): Int

Get position of x in array ar


afind

afind(Any x, Array ar): Any

Search for x in array ar, returns null if none found or x if found


aeach

aeach(Function _fn, Array ar): Void

Call fn() on each element of array ar


arem

arem(Any x, Array ar): Void

Remove x in array ar


#DOM


byId

byId(String id): Object

Get DOM elements by Id


byClass

byClass(String cl): Object

Get DOM elements by Class


allof

allof(String cl): Array<Object>

Get DOM elements by Class on document


byTag

byTag(String tg): Object

Get DOM elements by Tag


hasClass

hasClass(Object el, String cl): Any

Check if element has Class


addClass

addClass(Object el, String cl): Void

Add class to element


remClass

remClass(Object el, String cl): Void

Remove class from element


#String


polynomialHash

polynomialHash(String s): String

Calculate polynomial hash of String s


#AJAX


ajax

ajax(Function _fn(String response), String url): Promise<String>

A simple ajax with GET


pajax

pajax(Function _fn(String response), String url): Promise<String>

A simple ajax with POST