Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/defuj/def-helper
A collection of functions and methods to make it easier for you to create applications.
https://github.com/defuj/def-helper
functions hacktoberfest hacktoberfest2022 javascript methods react typescript vuejs
Last synced: 8 days ago
JSON representation
A collection of functions and methods to make it easier for you to create applications.
- Host: GitHub
- URL: https://github.com/defuj/def-helper
- Owner: defuj
- Created: 2022-10-13T01:54:40.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-20T05:54:06.000Z (about 2 years ago)
- Last Synced: 2024-09-28T03:55:43.169Z (about 1 month ago)
- Topics: functions, hacktoberfest, hacktoberfest2022, javascript, methods, react, typescript, vuejs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/def-helper
- Size: 25.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# def-helper
> A collection of functions and methods to make it easier for you to create applications.
[![NPM](https://img.shields.io/npm/v/def-helper.svg)](https://www.npmjs.com/package/def-helper) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
```bash
npm install --save def-helper
```## Usage
```tsx
import {
slugify,
validateEmail,
validatePhone,
getNumberInFirstString,
validateURL,
imageUrlToBase64,
getNumber,
compareObject
} from 'def-helper'const slug = slugify('Hello World')
// result will be "hello-world"const email = validateEmail('[email protected]')
// result will be trueconst phone = validatePhone('08123456789')
// result will be trueconst number = getNumberInFirstString('17676-Hello 123 World')
// result will be 17676const url = validateURL('https://google.com')
// result will be true// imageUrlToBase64([url image -> convert to base64],[url image if url image target is error], (result base64) => {
//
// })
const base64 = imageUrlToBase64(
'https://google.com/logo.png',
'https://img.kpopmap.com/2018/07/mbc-rebel.jpg',
(base64) => {
// result will be base64 string
}
)const number = getNumber('17676-Hello 123 World')
// result will be 17676123const compare = compareObject({ a: 1, b: 2 }, { a: 1, b: 2 })
// result will be true
const compare = compareObject({ a: 1, b: 2 }, { a: 1, b: 3 })
// result will be false```
## License
MIT © [defuj](https://github.com/defuj)
## Contributor