1.0.11 • Published 3 years ago
@i-is-as-i-does/jack-js v1.0.11
Jack Js
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.
Notable mentions
- 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!
How to
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'))
Overview
Check
isEmpty(it)
isElement(obj)
seemsLikeValidDate(string)
isNonEmptyStr(it)
isNonEmptyObj(it)
isNonEmptyArr(it)
isEven(numbr)
Help
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)
Stock
getSessionStorage()
getLocalStorage()
sizeInBytes(s)
jsonSize(obj, inKb = true, alreadyJson = false)
clearPartialStorage(store, threshold = 2000)
isStorageAvailable(type)
copyToClipboard(content, callback)
Style
nonRenderedElmHeight(elm)
elmHasStyle(elm, property)
cssExtract(strength = 2)
autoScrollToBottom(elm)
autoScrollToTop(elm)
Web
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)
Contributing
Sure! You can take a loot at CONTRIBUTING.
License
This project is under the MIT License; cf. LICENSE for details.