You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

simple_and_fast_add

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple_and_fast_add

very simple and fast way to sum numbers (int and float or float float etc)

0.0.4
latest
npmnpm
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

simple_and_fast_add

Its awesome module. So simple, and so fast

Features

  • can sum: float and float int and float float and int int and int

Install

npm i simple_and_fast_add

and import class Sum from this package

const Sum = require('simple_and_fast_add');

Example

  • Add and print result
const Sum = require('simple_and_fast_add');
//use async. its very important
(async () => {
	const Adder = new Sum();
	await Adder.getValuesStorage()
	//add first value to storage
	.addValue(new Sum.Number(5))
	.then(indx => {
		Adder.lastIndex = indx.last;
		Adder.preLastIndex = indx.preLast;
	})
	.catch(error => new Sum.Error(error));
	await Adder.getValuesStorage()
	//add second value to storage
	.addValue(new Sum.Float(3.14))
	.then(indx => {
		Adder.lastIndex = indx.last;
		Adder.preLastIndex = indx.preLast;
	})
	.catch(error => new Sum.Error(error))
	//add just add it
	const SumManager = new Sum.Manager();
	SumManager.setAdder(Adder);
	SumManager.trySum()
	.then(s => console.dir(new Sum.Result(s).toString()))
	//"5+3.14=8.14"
	//Ya :) we get answer. So easy
	.catch(error => {
		// DEPRECATED TRICK
		console.log(5 + 3.14)
	});
})();

Keywords

simple

FAQs

Package last updated on 07 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts