@smartsoft001/utils

npm i @smartsoft001/utis

Usage no npm install needed!

<script type="module">
  import smartsoft001Utils from 'https://cdn.skypack.dev/@smartsoft001/utils';
</script>

README

@smartsoft001/utils

Usage

npm i @smartsoft001/utis

ArrayService

Methods:

addItem creating new array with pushed item
removeItem creating new array without item
sort return sorted array

GuidService

Methods:

create creating guid string

NipService

Methods:

isValid(nip: string) check valid nip format
isInvalid(nip: string) check invalid nip format

ObjectService

Methods:

createByType(data: any, type: any): T create object with data
removeTypes(obj: any): any remove object type from data

PasswordService

Methods:

hash(p: string): Promise hash password text
compare(p: string, h: string): Promise compare password text with hashed text

PeselService

Methods:

isValid(pesel: string) check pesel format
isInvalid(pesel: string) check invalid pesel format

SpecificationService

Methods:

valid(value: T, spec: { criteria: any }, custom: ISpecificationCustom = null): boolean checking if the value meets the specifications
invalid(value: T, spec: { criteria: any }, custom: ISpecificationCustom = null): boolean checking if the object does not meet the specifications
getSqlCriteria(spec: { criteria: any }): string convert specification to sql

ZipCodeService

Methods:

isValid(code: string) check zip code format
isInvalid(code: string) check invalid zip code format