JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q5608F
  • License MIT

a collection of helper functions to make your life easy

Package Exports

  • doitfast
  • doitfast/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (doitfast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

doitfast is a collection of functions that can help you do it FAST .

getIntervalsBetweenShifts :

given the start & end time in 24Hr format this function will return an array of the times in between with interval of of 30 minutes as a default but it can be changes keeping in mind this format "hh:mm" & smaller than the difference between the shift duration

getIntervalsBetweenShifts(startTime,endTime,interval,isItToday?)

import { getIntervalsBetweenShifts, isItToday } from "doitfast";

let shifts = getIntervalsBetweenShifts("09:00", "17:00","00:30", isItToday(new Date()));
//isItToday is a function returns a boolean indicates if the input date is tody or not
// using today as a paramenter will remove the intervals before now,you can use any day instead of new Date() or you can simply input true/false

arrangDays :

simple function accepts an array of dates and arrange them accending or decending

import { arrangeDays } from "doitfast";

let arrangedDays = arrangeDays([
"5/22/2012",
"5/21/2012",
"5/20/2012",
new Date(),"accending"
]);

appendItem :

simple function to append values to keys helpful when sending api requests that upload images

import { appendItem } from "doitfast";
let data=formData()
let values={
name:"Max",
age:28,
//profile_photo:File  i.e the uploaded file
}
Object.keys(values).forEach((key) => {
      appendItem(data, key, values[key]);
    });

calcDiscount is to caculate total price of a product depending on the quantity if more than one the price will be caculated for the discountPrice

calcDiscount (basePrice, discountPrice, quantity, minCharge)

import { calcDiscount } from "doitfast";

let totalPrice = calcDiscount(100, 50, 2, 10);

getCommonInArrays:

this simple function returns the common between any number of arrays

import { getCommonInArrays } from "doitfast";
let arr1=[1,2],
    arr2=[2,3],
    arr3=[5,6,2,3,1,7,5];
const common=getCommonInArrays(arr1,arr2,arr3) // 2

the package will be updated regularly