Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mudssrali/js-helpers
Contains JavaScript cool ready to use helper functions
https://github.com/mudssrali/js-helpers
es6 es6-javascript esnext helper-functions javascript reactjs typescript utilities
Last synced: 3 days ago
JSON representation
Contains JavaScript cool ready to use helper functions
- Host: GitHub
- URL: https://github.com/mudssrali/js-helpers
- Owner: mudssrali
- License: mit
- Created: 2019-10-21T08:00:33.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T11:41:16.000Z (7 months ago)
- Last Synced: 2024-04-14T01:13:40.356Z (7 months ago)
- Topics: es6, es6-javascript, esnext, helper-functions, javascript, reactjs, typescript, utilities
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript Helpers
Some hand-crafted ES6 based JavaScript (type guarded - [TypeScript](https://github.com/mudssrali/typescript-cheatsheet) based) utility functions:
- **Convert blob to base64 string**
```ts
canvasToBlob( canvas: HTMLCanvasElement, options: Options = {})
```
[View Code](./src/canvasToBlob.ts)- **Convert blob to base64 string**
```ts
blobToBase64(blob: Blob)
```
[View Code](./src/blobToBase64.ts)- **String utils**
```ts
isValidLength(str: string, minLength: number)
isValidEmail(email: string)
removeFileExtension(filename: string)
```[View Code](./src/string.ts)
- **Split Array into Chunks**
```js
chunkify(kvArray = [], chunkSize = 10, reverse = false): Array<[]>
```[View Code](./src/chunkify.js)
- **Split Array into Chunks** - V2
```js
chunkify(kvArray = [], chunkSize = 10): Array<[]>
```[View Code](./src/chunkify2.js)
- **Split Array into Chunks** - V3```js
chunkify(kvArray: T[], chunkSize: number): Array
```[View Code](./src/chunkify3.ts)
- **Check number**
```js
isDecimalNumber(number: any): boolean
isFloat(value: any): boolean
```[View Code](./src/typeTeller.js)
- **Convert text to Titled-Case**
```js
toTitleCase(text: string, delimiter = ' '): string
```> e.g. toTitleCase("mUdAssaAr lOves OpEn SouRCe") ===========> Mudassar Loves Open Source
[View Code](./src/toTitleCase.js)- **Prettify Number**
**Description**: Prettify a number for use in the application. Use toLocaleString, but also force a standard number of decimal places if it's a float.```js
prettifyNumber(number): string
```[View Code](./src/prettifyNumber.js)
- **Random Color Code Generator**
```js
randomColorGenerator(): string
```[View Code](./src/randomColorGenerator.js)
- **Bump Array Sort**
**Description**: Return a new sorted array, except with one value bumped to the front. This function does not sort an array in place; a new array is returned.```js
bumpSort(kvArray: Array, bumpValue: any): Array
```[View Code](./src/bumpSort.js)
- **Sort Year Months**
```js
sortYearMonths(kvSet: Set): Array
sortYearMonths(kvArray: Array): Array
```[View Code](./src/sortYearMonths.js)
- **Array Utils**
```js
isEqual(array1: Array, array2: Array): boolean
takeRight(array: Array, n: number): Array
```[View Code](./src/arrayUtils.ts)
- **Format File Size**
```js
formatFileSize(bytes: number, suffixIndex = 0): string
```[View Code](./src/formatFileSize.js)
- **Kebab Case to Title Case**
```js
kebabToTitleCase(str: string): string
```[View Code](./src/kebabToTitleCase.js)
## Contributions
Contributions of any kind are welcome.
[MIT-LICENSE](./LICENSE)