Skip to content

A collection of functions and methods to make it easier for you to create applications.

Notifications You must be signed in to change notification settings

defuj/def-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

def-helper

A collection of functions and methods to make it easier for you to create applications.

NPM JavaScript Style Guide

Install

npm install --save def-helper

Usage

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('user@mail.com')
// result will be true

const phone = validatePhone('08123456789')
// result will be true

const number = getNumberInFirstString('17676-Hello 123 World')
// result will be 17676

const 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 17676123

const 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

Contributor

Thanks to all amazing contributors