Gathering detailed insights and metrics for asm-ts-scripts
Gathering detailed insights and metrics for asm-ts-scripts
Gathering detailed insights and metrics for asm-ts-scripts
Gathering detailed insights and metrics for asm-ts-scripts
npm install asm-ts-scripts
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
A collection of my personal scripts, scripts I found on the Internet, maybe even modified
link → ameliance-scripts
npm i asm-ts-scripts
1import asm from 'asm-ts-scripts' 2 3const randomRGBColor = asm.getRandomRGBColor();
or
1import { getRandomRGBColor } from 'asm-ts-scripts' 2 3const randomRGBColor = getRandomRGBColor();
1const arr = ['a', 'b', 'c']; 2asm.addId(arr); 3// [ 4// { a: 'a', id: 0 }, 5// { b: 'b', id: 0 }, 6// { c: 'c', id: 0 } 7// ] 8 9const arr = [{ key: 'a' }, { key: 'b' }, { key:'c' }]; 10asm.addId(arr); 11// [ 12// { key: 'a', id: 0 }, 13// { key: 'b', id: 0 }, 14// { key: 'c', id: 0 } 15// ] 16 17const arr = [{ key: 'a' }, { key: 'b' }, { key:'c' }]; 18const ids = [2923, 0292, 8347] 19asm.addId(arr, ids); 20// [ 21// { key: 'a', id: 2923 }, 22// { key: 'b', id: 0292 }, 23// { key: 'c', id: 8347 } 24// ]
1const someVar = 'class-b' 2const someArr = [null, '', 'icon', '', '', undefined, ''] 3<Component {...asm.className(['class-a', undefined, someVar, someArr.length > 0 && someArr]);}/> 4// <Component className='class-a class-b icon'/>
1asm.clearLocalStorageAndReload();
1asm.createHTMLElem();
1asm.getCommonValues(['1', '2', '3'], ['3', '4'], ['3', '5']) 2// ['3'] 3 4asm.getCommonValues([1, 2, 3], [3, 4], [3, 5]) 5// [3] 6 7asm.getCommonValues(['1', '2', '3', 1], ['3', '4', 1], [1, '3', '5']) 8// ['3, 1]
1asm.getCurrentDateInMs() 2// 1675366990061
1asm.getDifferentValues(['1', '2', '3'], ['3', '4'], ['3', '5']) 2// ['1', '2'] 3 4asm.getDifferentValues([1, 2, 3], [3, 4], [3, 5]) 5// [1, 2] 6 7asm.getDifferentValues(['1', '2', '3', 1, 3], ['3', '4', 1], [1, '3', '5']) 8// ['1', '2', 3]
1asm.getIndexesOfNonEmptyElements(['1', '', '3']) 2// [0, 2]
1asm.getRandomHEXColor(); 2// '#FFAA00'
1asm.getRandomNumber(0, 7); 2// 5
1asm.getRandomRGBColor(); 2// [255, 10, 8]
1asm.getScrollDirection(); 2// 'UP' 3// 'DOWN'
1asm.groupBy(['aa', 'aq', 'ab', 'bx', 'ba']); 2// [ 3// [a, ['aa', 'aq', 'ab]], 4// [b, ['bx', ba]] 5// ] 6 7asm.groupBy([ 8 {key1:'aa', key2: 1 }, 9 {key1:'aq', key2: 3 }, 10 {key1:'ab', key2: '2' }, 11 {key1:'bx', key2: '5' }, 12 {key1:'ba', key2: 4 } 13]), 'key1'; 14//[ 15// [a, [ 16// {key1:'aa', key2: 1 }, 17// {key1:'ab', key2: '2' }, 18// {key1:'aq', key2: 3 }, 19// ]], 20// [b, [ 21// {key1:'ba', key2: 4 } 22// {key1:'bx', key2: '5' }, 23// ]] 24//]
1asm.getToday(); 2// 2024-12-09
1asm.isObject({ a: 'a' }); 2// true
1asm.isObjectEmpty({ a: 'a' }); 2// false
1const someVar = 'class-b' 2const someArr = [null, '', 'icon', '', '', undefined, ''] 3asm.join(['class-a', undefined, someVar, someVar, someArr.length > 0 && someArr]); 4// 'class-a class-b icon'
1const someVar = 'class-b' 2const someArr = [null, '', 'icon', '', '', undefined, ''] 3asm.joinWith(',', ['class-a', undefined, someVar, someVar, someArr.length > 0 && someArr]); 4// 'class-a, class-b, icon'
1asm.parseCurrentDateFromMs(1675366990061); 2// Thu Feb 02 2023 21:43:10 GMT+0200
1asm.removeEmptyValues(['', '', 'a', '', 'b', '', '']); 2// ['a', 'b'] 3 4asm.removeEmptyValues([ 5 {key1: '', key2: 'someKey'}, 6 {key1: '', key2: 'someKey'}, 7 {key1: 'a', key2: 'someKey'}, 8 {key1: '', key2: 'someKey'}, 9 {key1: 'b', key2: 'someKey'}, 10 {key1: '', key2: 'someKey'}, 11 {key1: '', key2: 'someKey'}, 12], 'key1'); 13// [ 14// {key1: 'a', key2: 'someKey'}, 15// {key1: 'b', key2: 'someKey'} 16// ]
1asm.returnError(error); 2 3const APP_NAME = 'app-name' 4export function returnError() { 5 asm.returnError(string, APP_NAME, 1); 6}
1asm.setIntervalCounts({ () => console.log('Hello'), 1000, 3 }) 2// Hello // 1st time after delay 1s 3// Hello // 2nd time after delay 2s 4// Hello // 3rd time after delay 3s
1asm.shuffleArray(['a', 'b', 'c']); 2// ['b', 'c', 'a']
1asm.sortArrayLocalCompare(['Яблуко', 'ćma', 'BBC', '10', 'fast']); 2// ['10', 'Яблуко', 'BBC', 'ćma', 'fast'] 3 4asm.sortArrayLocalCompare([ 5 {key1: 'Яблуко', key2: 'someKey'}, 6 {key1: 'ćma', key2: 'someKey'}, 7 {key1: 'BBC', key2: 'someKey'}, 8 {key1: '10', key2: 'someKey'}, 9 {key1: 'fast', key2: 'someKey'}, 10], 'key1'); 11// [ 12// {key1: '10', key2: 'someKey'}, 13// {key1: 'Яблуко', key2: 'someKey'}, 14// {key1: 'BBC', key2: 'someKey'}, 15// {key1: 'ćma', key2: 'someKey'}, 16// {key1: 'fast', key2: 'someKey'}, 17// ]
1asm.sortArrayOfObj();
1asm.stringCut('long string', 5); 2// 'long...' 3 4asm.stringCut('long string', 8, '=)'); 5// 'long str=)'
1asm.toTimeFormat(60); // 00:60
1asm.trimEndEmptyValues(['', '', 'a', '', 'b', '', '']); 2// ['', '', 'a', '', 'b'] 3 4asm.trimEndEmptyValues([ 5 {key1: '', key2: 'someKey'}, 6 {key1: '', key2: 'someKey'}, 7 {key1: 'a', key2: 'someKey'}, 8 {key1: '', key2: 'someKey'}, 9 {key1: 'b', key2: 'someKey'}, 10 {key1: '', key2: 'someKey'}, 11 {key1: '', key2: 'someKey'}, 12], 'key1'); 13// [ 14// {key1: '', key2: 'someKey'}, 15// {key1: '', key2: 'someKey'}, 16// {key1: 'a', key2: 'someKey'}, 17// {key1: '', key2: 'someKey'}, 18// {key1: 'b', key2: 'someKey'} 19// ]
1asm.trimStartEmptyValues(['', '', 'a', '', 'b', '', '']); 2// ['a', '', 'b', '', ''] 3 4asm.trimStartEmptyValues([ 5 {key1: 'a', key2: 'someKey'}, 6 {key1: '', key2: 'someKey'}, 7 {key1: 'b', key2: 'someKey'}, 8 {key1: '', key2: 'someKey'}, 9 {key1: '', key2: 'someKey'}, 10], 'key1'); 11// [ 12// {key1: 'a', key2: 'someKey'}, 13// {key1: '', key2: 'someKey'}, 14// {key1: 'b', key2: 'someKey'}, 15// {key1: '', key2: 'someKey'}, 16// {key1: '', key2: 'someKey'} 17// ]
1asm.writeTextToClipboard('some text string');
1asm.getLocalStorage(APP_NAME, 'user', 'displayName', 'Ameliance SkyMusic');
1asm.setLocalStorage(APP_NAME, 'user', 'displayName', 'Ameliance SkyMusic');
0.2.1 [2023_05_02]:
#: fix readme link
0.2.0 [2023_05_02]:
^: move library to https://www.npmjs.com/package/ameliance-scripts
0.1.104 [2023_05_02]:
+: add writeTextToClipboard
+: add toTimeFormat
+: add returnError
+: add joinWith
+: add getToday
+: add clearLocalStorageAndReload
+: add setLocalStorage to _LAB
+: add getLocalStorage to _LAB
*: update types anc add some improvements sortBy
*: update types anc add some improvements removeEmptyValues
*: update types anc add some improvements sortArrayLocalCompare
0.1.103 [2023_03_06]:
+: add addId
0.1.102 [2023_02_02]:
*: rename joinClasses to join
#: fix join
+: add className
+: add setIntervalCounts
+: add getCurrentDateInMs
+: add parseCurrentDateFromMs
0.1.101 [2023_01_02]:
#: fixes
0.1.1 [2023_01_02]:
+: add isObject
+: add getCommonValues
+: add removeEmptyValues
+: add getDifferentValues
+: add trimEndEmptyValues
+: add trimStartEmptyValues
+: add getIndexesOfNonEmptyElements
^: add support sorting objects in groupBy
^: add support sorting objects in sortArrayLocalCompare
*: rename combineListToSortedArray to groupBy
*: rename sortStringArrayLocalCompare to sortArrayLocalCompare
*: refactor code
0.0.107 [2022_12_22]:
^: update readme file
0.0.106 [2022_12_22]:
^: update readme file
0.0.105 [2022_12_22]:
#: fix export
^: update readme file
0.0.104 [2022_12_22]:
+: add sortStringArrayLocalCompare
#: fix stringCut
^: clean code
0.0.103 [2022_12_22]:
+: add combineListToSortedArray
#: fix joinClasses
0.0.102 [2022_12_17]:
^: update readme file
0.0.101 [2022_12_17]:
^: update readme file
0.0.100 [2022_12_17]:
+: add createHTMLElem
+: add getRandomHEXColor
+: add getRandomNumber
+: add getRandomRGBColor
+: add getScrollDirection
+: add isObjectEmpty
+: add joinClasses
+: add shuffleArray
+: add sortArrayOfObj
+: add stringCut
No vulnerabilities found.
No security vulnerabilities found.