Minimal sets of utilities.
Jack of all trades is now in Javascript flavour!
PHP counterpart over here.
This is a work in progress.
Cherrypick anything.
- easy dynamic CSS/JS loading
- easy oembed request
- pretty url shorteners
- element-in-dom promise
- template CSS stylesheet generator
- easy local storage handling
Just take a look at those files already!
Install
npm install @i-is-as-i-does/jack-js
Use
import Jack from '@i-is-as-i-does/jack-js';
console.log(Jack.ucFirst('bob'))
isEmpty(it)
isElement(obj)
seemsLikeValidDate(string)
isNonEmptyStr(it)
isNonEmptyObj(it)
isNonEmptyArr(it)
isEven(numbr)
ucFirst(string)
randomInt(min, max)
charCut(string, limit, cutAnywhere = false)
randomString(length = 10)
waitForElmInDOM(elmSelector, parentElm = null)
replaceDiacritics(text)
escapeRegExp(string)
deepCopy (obj)
splitOnLineBreaks (string)
toNum(string)
getSessionStorage()
getLocalStorage()
sizeInBytes(s)
jsonSize(obj, inKb = true, alreadyJson = false)
clearPartialStorage(store, threshold = 2000)
isStorageAvailable(type)
copyToClipboard(content, callback)
nonRenderedElmHeight(elm)
elmHasStyle(elm, property)
cssExtract(strength = 2)
autoScrollToBottom(elm)
autoScrollToTop(elm)
loadJs(signatureVar, url)
isValidHttpUrl(string)
loadJson(url)
oembedLink(url, provider, maxwidth = null, maxheight = null)
oembedResponse(oembedLink)
oembedIframe(oembedResponse)
pathBasename(path)
pageHasSheet(signatureRule, url)
loadCss(signatureRule, url, shadowRootElm = null)
loadPagePreviewImg(url, useCache = true)
conciseUrl(string, withPath = true)
miniUrl(string)
searchUrlParam(name)
toLastSlash(url)
displayUrl (url)
stripHttp (url)
stripLastSlash (url)
Sure! You can take a loot at CONTRIBUTING.
This project is under the MIT License; cf. LICENSE for details.