1.0.9 • Published 2 years ago

dattx328-ts-helpers v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Installing

Using npm:

$ npm i dattx328-ts-helpers

Example

import { copyToClipboard, isDateValid } from 'dattx328-ts-helpers';

copyToClipboard('Text to clipboard');

isDateValid('2020 03 20');

Func

FuncDescriptionParameterReturn
copyToClipboardCopy to Clipboardtext: string
isDateValidCheck if Date is Validdate: stringtrue/false
dayOfYearFind the day of the yeardate: stringdate
getLastDayOfMonthReturn last instance of week day for given year and monthyear: number, month: number, day: stringdate
timeFromDateLog Time from Datedate: Datetime
capitalizeCapitalize a Stringstr: stringstring
dayDifFind the number of days between two daysstart: any, end: anynumber
clearCookiesClear All Cookies
randomHexGenerate Random Hexhex
removeDuplicatesRemove Duplicated from Arrayarr: any[]array
getQueryParamsGet Query Params from URLurl: stringstring
arrayToCSVThis snippet converts the elements that don’t have commas or double quotes to strings with comma-separated values.arr: any[], delimiter: string = ','arr
averageThis snippet returns the average of two or more numerical values....nums: number[]num
bottomVisibleThis snippet checks whether the bottom of a page is visible.true/false
differenceTwoArraysThis snippet finds the difference between two arrays.a: any[], b: any[]array
getStyleThis snippet can be used to get the value of a CSS rule for a particular element.el: any, ruleName: stringstyles
hasClassThis snippet checks whether an element has a particular class.el: any, className: stringboolean
insertAfterThis snippet can be used to insert an HTML string after the end of a particular element.el: any, htmlString: string
insertBeforeThis snippet can be used to insert an HTML string before a particular element.el: any, htmlString: string
isBrowserThis snippet can be used to determine whether the current runtime environment is a browser.boolean
isBrowserTabFocusedThis snippet can be used to determine whether the browser tab is focused.boolean
randomIntArrayInRangeThis snippet can be used to generate an array with n random integers in a specified range.min: number, max: number, n: number = 1array
randomIntegerInRangeThis snippet can be used to generate a random integer in a specified range.min: number, max: numbernumber(integer)
randomNumberInRangeThis snippet can be used to return a random number in a specified range.min: number, max: numbernumber
redirectToThis snippet can be used to do a redirect to a specified URL.url: string, asLink: boolean = true
reverseStringThis snippet can be used to reverse a string.str: anyhex
sortArraySort array by keyarr: any[], key: string, orderBy: string = 'asc'array
scrollToTopSmooth-scroll to the top of the page
createTimerCreate a countdown timerstart: string, end: stringobject
isMobileCheck is mobileboolean
validateEmailValidate email addressemail: stringboolean
removeNonASCIIRemove characters that are not ASCIIstr: stringstring
slugifySlug characterstext: stringstring
generateVariantsGenerate variantsattributes: any = {colors: [], sizes: []}array
forceDownloadFileDownload fileurl: string
copyToClipboardV2Copy to clipboard with text areatext: string
formatNumberFormat numbernum: any, format: string = 'en-US'string
formatVideoTimeFormat video timeseconds: anystring
formatFileSizeFormat file sizesize: anystring
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago