@marjose/jstoolkit
v1.0.0-beta
Published
Custom Javascript Toolkit
Downloads
16
Maintainers
Readme
Get's Started!
https://jstoolkit.readthedocs.io/en/latest/
What should i know?
jstoolkit.min.jsis a static namespace class.
you must build first using the gradle.
after you build using the Gradle
jstoolkit.min.jswill be placed inside theBuildfolder.
install
npm i @marjose/jstoolkitUsage
<script type="text/javascript" src = 'jstoolkit.min.js' ></script> Debugging Static
Toolkit.Debugging
- Console
- log
The log console color is using the bootstrap
hexcolor alert.- warning
Example Syntax: Toolkit.Debugging.Console.log.warning('This is a warning debugging console with color'); ``` - info
Example Syntax: Toolkit.Debugging.Console.log.info('This is a info debugging console with color'); ``` - success
//Example Syntax: Toolkit.Debugging.Console.log.success('This is a success debugging console with color'); ``` - danger
/* Example Syntax: */ toolkit.Debugging.Console.log.danger('This is a danger debugging console with color'); ```
- warning
- Text
The log console color is using the bootstrap
hexcolor alert.- banner
banneris similar to thelogbut in different text format and styles.[x] Danger
Example Syntax: toolkit.Debugging.Text.Banner.danger('This is a danger debugging console with color');[x] Success
Example Syntax: toolkit.Debugging.Text.Banner.success('This is a success debugging console with color');[x] Info
Example Syntax: toolkit.Debugging.Text.Banner.info('This is a info debugging console with color');[x] Warning
Example Syntax: toolkit.Debugging.Text.Banner.warning('This is a danger debugging console with color');
- banner
- log
Interface Static
Toolkit.Interface
- DesignMode
This
featureyou can edit/modify your live web page design on real-time Note: ThisDesingModeis just a temporary design.- [x] On
Example Syntax: Toolkit.Interface.On(); - [x] Off
Example Syntax: Toolkit.Interface.Off();
- [x] On
HTTP Static
Toolkit.HTTPThis will return a promises.
[x] GET
Note
headervariable/parameter must beKey-Value. headers = {"Accept": 'application/json'}Example Syntax Call: toolkit.HTTP.GET(url, headers);[x] POST
Note:
headervariable/parameter must beKey-Value. headers = {"Accept": 'application/json'} Variabledatais the data fromFormsubmit.Example Syntax Call: toolkit.HTTP.POST(url, headers,data);
Filter Static
Currency
[x] Money
Toolkit.Filter.Currency.Money(locales, CurrencySymbol,CurrencyDigitMoney)A. Parameter:
localesFirst, you have the locales, this is the language and region settings. It is made up of language code and the country code.
language code + country codeExample:
> en-CA en = English (language) CA = Canada (country)en-Ph en = English (language) Ph = Philippines (country) Some More example en-IN (English India) fr-CA (French Canada) ja-JP (Japanese Japan)B. Parameter:
CurrencySymbolExample Table
Country | Alphabetic Code -------- | ----- AUSTRIA | EUR AZERBAIJAN | AZN Philippines| PHP BAHRAIN | BHD BANGLADESH |BDT BARBADOS | BBD BELARUS | BYN BELGIUM | EUR BELIZE |BZD BENIN |XOF BERMUDA | BMD BHUTAN | INR BRAZIL | BRL
Here are some examples:
- CAD (Canadian dollar)
- USD (US dollar)
- EUR (Euro)
- CNY (Chinese RMB)
References: Current currency & funds code list
let res = toolkit.Currency.Money('en-Ph','PHP',1000) console.log(res); > Result: ₱1,000.00
[x] isArray
Toolkit.Filter.IsArray(values);This will return a
booleanresult.[x] isJsonObject
Toolkit.Filter.isJsonObject(values);This will return a
booleanresult.[x] Unique
Toolkit.Filter.Unique(jsonobject, comp);This
functionwill remove the duplication data from the JSON Object$ > Example Code: const arrayObj = [ { id: 1, name: "king" }, { id: 2, name: "master" }, { id: 3, name: "lisa" }, { id: 4, name: "ion" }, { id: 5, name: "jim" }, { id: 6, name: "gowtham" }, { id: 1, name: "jam" }, { id: 1, name: "lol" }, { id: 2, name: "kwick" }, { id: 3, name: "april" }, { id: 7, name: "sss" }, { id: 8, name: "brace" }, { id: 8, name: "peiter" }, { id: 5, name: "hey" }, { id: 6, name: "mkl" }, { id: 9, name: "melast" }, { id: 9, name: "imlast" }, { id: 10, name: "glow" } ]; let res = toolkit.Filter.Unique(arrayObj, 'id'); console.log(res); > Result: Array(10) 0: {id: 1, name: "king"} 1: {id: 2, name: "master"} 2: {id: 3, name: "lisa"} 3: {id: 4, name: "ion"} 4: {id: 5, name: "jim"} 5: {id: 6, name: "gowtham"} 6: {id: 7, name: "sss"} 7: {id: 8, name: "brace"} 8: {id: 9, name: "melast"} 9: {id: 10, name: "glow"} length: 10 __proto__: Array(0)Example Syntax Call: toolkit.Filter.Unique(arrayObj, comp);
Building and Minify JS using Gradle
instruction:
Windows:
- install Gradle
- then goto the project folder build and type:
gradle minifyjsorclean
Linux
- install gradle by using
apt.sudo apt install gradle- then goto the project folder build and type:
gradle minifyjsorclean
#TODO
- [] Update Readme
- [] Create wiki Documentation
- [] Build
