Giter Club home page Giter Club logo

funckage's Introduction

FUNCKAGE

FUNCTIONS (We all know what this is.) - KAGE (shadow, shade, other side and shadows.)

LOCAL STORAGE

Add data to localStorage temporarily without the need to delete them manually.

import { store } from 'funckage'

const login (userData)=>{
  const response = await api.call("/login-url")
  const { token } = response;

  // default ttl of 24hours (key, data, ttl)
  store.setWithExpiry('token', token)
}

Then you can access it within the ttl;

import { store } from 'funckage'

const getUserData (userData)=>{
  // will return null if queried after ttl
  const token = store.getWithExpiry('token')

  const response = await api.call("/get-data-url", { headers: { 'auth-token': token } } )
  // use response in application
}

Arrays

Add ,delete and update objects in arrays with a key of id

import { data } from "funckage";

const updateCollection = (collection, item) => {
  return updateItem(collection, item);
  // Updates the object item in the collection array
};
import { data } from "funckage";

const addToCollection = (collection, item) => {
  return array.addItem(collection, item);
  // pushes item to the collection array
};
import { data } from "funckage";

const deleteItemFromCollection = (collection, item) => {
  return array.deleteItem(collection, item);
  // delete item from a collection of array
};

Maths

perform basic math functions

import { data } from "funckage";

 const = maths.compound(amount, percentage, period)
//  calculate compound intrest

Strings

Capitalize the first word of a string

import { data } from "funckage";

string.capitalize("foobar");
// will return Foobar

Remove country code from an array of phone numbers

string.removeCountryCode([+9123434576, 23423432234]);
// remove the country code from phone numbers

funckage's People

Contributors

igmrrf avatar thrila avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.