0.0.32 • Published 4 years ago

maksof-common v0.0.32

Weekly downloads
136
License
ISC
Repository
github
Last release
4 years ago

This repository contains the common javascript functions mostly used in all the project.

maksof-common

Table of Contents

Install

npm i maksof-common

Usage

In order to use function you have to create a variable and require module to it and  call these function by this reference variable
Some function samples from following classes are as follow
like this,

const common = requires('maksof-common'); common.requiredFuncton();

data-extractor

get-certificate-key

const common = requires('maksof-common');
common.getCertificateKey()

send-response-back

const common = requires('maksof-common');
common.sendResponseBack(res, status, message, data)

generate-bluff-Id

const common = requires('maksof-common');
 common.generateBluffId()

generate-key

 generatekey()

generate-unique-profilekey

generateUniqueProfileKey()

del-from-array

const common = requires('maksof-common');
common.delFromArray(array, index);

common.delFromArray([1,2,3,4,5],4);
output->[1,2,3,4]

del-multiple-index-from-array

 const common = requires('maksof-common');
 common.delMultipleIndexFromArray(array , indexes);
 
 common.delMultipleIndexFromArray([1,2,3,4,5] , [2,3]);
 output->[1,2,5]

merge-array

mergeArray(array1, array2);
mergeArray([1,2,3],[4,5,6]);
output->[1,2,3,4,5,6]

difference-array

differnceArray(array1, array2);
differnceArray([1,2,3,4],[3,5,6])
output->[1,2,3]

max-value-from-array

const common = requires('maksof-common');
common.maxValueFromArray(array);

common.maxValueFromArray([4,5,1,3]);
output->5

min-value-from-array

minValueFromArray(array);
minValueFromArray([4,5,1,3]);
output->1

array-shuffle

const common = requires('maksof-common');
common.arrayShuffle(array);

common.arrayShuffle([1,2,3,0,10]);
output->[1, 3, 10, 2, 0]

del-key-from-obj

delKeyFromObj(obj, key);
delKeyFromObj({name : "sunny", id : 2}, "name");
output-> {id: 2}

find-key-in-object

findKeyInObject(obj, key);
findKeyInObject({name : "sarwar", id : 2}, "name")
output-> true

static-find-prop-from-obj

staticfindPropFromObj(obj, key);
staticfindPropFromObj({name : "sarwar", id : 2}, "name");
output-> ["sarwar"]

sort-num-asc

sortNumAsc(array);
sortNumAsc([2,10,54,100,1]);
output->[1, 2, 10, 54, 100]

sort-num-des

sortNumDes(array);
sortNumDes([2,10,54,100,1]);
output->[100,54,10,2,1]

sort-data

sortData(data)
sortData(["Apple","Azggas","Zasdas","Ccca"]);
output-> ["Apple", "Azggas", "Ccca", "Zasdas"]

sort-data-rev

sortDataRev(data)
sortDataRev(["Apple","Azggas","Zasdas","Ccca"]);
output-> ["Ccca", "Zasdas", "Azggas", "Apple"]

symetric-differenc

symetricDifference(array1, array2);
symetricDifference([1,3,5,7,9],[2,6,5]);
output-> [1, 3, 7, 9, 2, 6]

intersection

intersection(array1, array2);
intersection([1,3,5,7,9],[2,6,5]);
output-> [5]

date-formatter

const common = requires('maksof-common');
commom.dateStatement (dateString);

-formatShortDayNameDMY(dateString)

formatShortDayNameDMY("Monday, 22 February 2021")
formatFullDayNameDMY("Monday, 22 February 2021")
 formatShortDayNameDMYHM24("Monday, 22 February 2021 12:10 PM")

field-validator

is-empty

const common = requires('maksof-common');
commom.isEmpty(str);
common.isEmpty(" ");
output-> true

is-phone-number

const common = requires('maksof-common');
commom.isPhoneNumber(str);
common.isPhoneNumber("+92302411562");
output-> truie

is-email

isEmail(str);
isEmail(no@gmail.com);
output-> true

password-pattren-check

// capital letter madatory
//special charcher or number mandatory
passwordPattrenCheck(password);
passwordPattrenCheck("Karachi@12");
output-> true

is-password-confirmed

isPasswordConfirmed(password, confirm);
isPasswordConfirmed("Karachi@12", "Karachi@12");
output-> true

is-valid-creditCard

isValidCreditCard(creditCard);

is-valid-zipcode

isValidZipcode(zipcode);

is-date

isDate(date);

is-valid-dob

isValidDob(dob);

is-array-empty

isArrayEmpty(array);

is-obj-empty

isObjEmpty(obj);

is-boolean

isBoolean(value);

is-null

isNull(value);

is-nan

isNaN(value);

is-number

isNumber(value);

is-JSON

isJSON(value);

is-same-type

isSameType(val1, val2);

check-valid-username

checkValidUsername(username)

numerical-calculator

-percentage (output,input)

const common=requires('maksof-common');
common.percentage(output,input);

common.percentage(80,90);
output -> 88.88%
const common=requires('maksof-common');
common.ageCalculator(dob);.

common.ageCalculator("22 February 2011");
output -> 10
0.0.30

4 years ago

0.0.31

4 years ago

0.0.32

4 years ago

0.0.27

4 years ago

0.0.29

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.12

4 years ago

0.0.15

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago

1.0.0

4 years ago