npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flame-tools

v1.2.5-beta

Published

Frequently used Javascript Tools

Downloads

23

Readme

Flame-Tools JS Documentation

install size npm bundle size npm downloads gitter chat Known Vulnerabilities

Flame-Tools is a JavaScript Libray of frequently used tools for JavaScript Developers.

It is a collection of solutions to some algorithm intensive and time consuming recurrent task that developers always encounter in the process of implementing Application solutions in JavaScript. The tools are listed below.

Flame-Tools

  • sum -> The sum tool is very useful for summing up numbers which are supplied as individual parameters, array of numbers or array of objects to sum a particular column.

To calculate sum of a given column in an array of objects, make sure the last item in the array is a function that takes in an iterator and returns the column to be calculated (e.g [...testArr, (i)=>testArr[i].amount]) and then feed the sum function with the array.

You can feed the sum tool with numbers, array of numbers and array of objects at the same time and the sum tool would handle the addition for all numeric values supplied including those wrapped in quotes as a string.

The Tool does not break any process even when it encounters a non-number item as it rather returns an object of the sum, bad parameters, errors and count of successful additions. Check the code example below for usage.

  • funSeque -> This tool executes functions sequentially in an interval you provide, we can describe it as Promises with more control. Check the code example below for usage.

  • acronym -> This tool abbreviates strings according to configurations you provide, it can be useful when you want to get the first Letter(s) of a word or first Letter(s) of range of words. Check the code example below for usage.

  • percentage -> This tool takes values and returns an object of the total value, actual value and percentage of the actual value. You can supply the percentage and total value and obtain the actual value. It is applicable to all use cases of percentage. Check the code example below for usage.

Installation

npm i flame-tools

Import

import {sum, funSeque, acronym, percentage} from 'flame-tools'

USAGE

//sum
    let items=[
        {item:'Book', amount:400}, 
        {item:'Pen', amount:100}, 
        (i)=>items[i].amount
    ];
    
    let numbers=[1,6,7,9,'bad_dfdf'];

    let result=sum(4, 5, 7, 7, 5, numbers, items);

    console.log(result.sum, 'sum')

    console.log(result.count, 'count')

    console.log(result.errors, 'error?')

    console.log(result.badParameters, 'badParams')




// funSeque

funSeque(

    {delaySeconds:5, isPromise:true},

    ()=>{
        console.log('Book is a writing material')
    },

    ()=>{
        console.log('Goat is a domestic animal')
    },

    ()=>{
        console.log('Helping is a great investment')
    }     
    
    
    )




// acronym
console.log(acronym('Erim Emmanuel', {
    mutipleWords: true;
    lengthOfResult: 2;
}))




//percentage
console.log(percentage({value:5, totalValue:25}).percent)