codewonders-helpers
v1.1.0
Published
A Small Helpers Utility Functions For Javascript Development
Downloads
201
Maintainers
Readme
Codewonders Helpers
This is a small helpers utility functions for javascript development. In here are the regular functions i use in my development feel free to contribute.
Helper Functions
Array Helpers
arrayRandomItem - This allows you pick a random item in an array see more here
arrayPickOne - This allows you pick a random item with its index in an array see more here
arrayShuffleItems - This allows you to switch array index on document loaded in an array see more here
arrayRemove - This allows you to remove item from with a
cb
an array see more herejoin - This allows you to join items in an array with different seperators
start
andend
in an array see more here
Bind Helper
- bind - This allows you to bind functions / curried functions see more
here.
takes in
fn
,context
,boundArgs
Collect Into Helper
- collectInto - This collects functions into with an argument
here.
takes in
args
Cookie To Object Helper
- cookieToObject - Converts cookie to object
here.
takes in
cookie
Countries Helpers
countries-by-calling-code - Gets country and their call codes here.
countries-by-curreny-code - Gets country and their currency codes here.
countries-by-states - Gets country and their states here.
Encode and Decode
encode - encodes string to base 64 here. takes in
string
decode - decodes encoded string from base 64 here. takes in
string
utf8encode - encodes string to utf8 here. takes in
string
- utf8decode - decodes encoded string from utf8
here.
takes in
string
Cookie To Object Helper
- getRandomColor - returns random color
here.
returns color in
HEX
Still documenting :)
Install
$ npm install codewonders-helpers --save
Usage
Getting familiar with the package and you want to use some helper functions like
isEmpty
, isJsonString
,pxToRem
helpers and e.t.c you can easily just
export them the following ways.
import { isEmpty } from 'codewonders-helpers';
All methods are exported as a flat namesapce so you can also call them like this
import isEmpty from 'codewonders-helpers/bundle-es/is-empty';
or
var isEmpty = require('codewonders-helpers');
and then we have the exported helpers and can already do this
isEmpty({});
// => true
MIT © codewonders.dev · GitHub @adenekan41 / codewonders > ·