0.1.1
Durations to estimate impact over
A defult configuration map providing values for all input data fields. This lets you call the on-covid-19 API with just the input data you care about
Data fields for the region / continent
Currently reported / confirmed cases according to the authorities
The population you want to estimate the impact for
The number of hospital / health facility beds availabe to the population you want to estimate for
A default estimator function that gets used if the on-covid-19 API is called without one.
(Object
= defaultConfig
)
a map of input fields and values for the estimation. Default to defaultConfig
any
:
It just returns a template data structure
The onCovid19 api entrypoint function.
(Object
= {}
)
the input data
(Function
= defaultEstimator
)
the function handling estimation
Object
:
An object on which you can call
estimateImpactAfter(..)
with the duration to estimate for.
Calling
estimateImpactAfter(..)
then produces an object on which you can call
days()
,
week()
,
weeks()
, 'month()', or
months()
on,
allowing you indicate the period to estimate for.
import estimator from 'path/to/estimator.js';
const data = { population: 5000000, reportedCases: 247, ... }
const estimate = onCovid19(data, estimator)
.estimateImpactAfter(30)
.days();
Given an initial number value, this function lets you compute the percent of another value on the initial value
(Number)
the divisor of your percentage computation
Object
:
An object on which you can call an "is" function with the (dividend) figure you want to compute it percentage. Calling the "is" function returns the final computed percentage value
const salary = 1500000;
const whatPercentOfPay = whatPercentOf(salary);
const airtimeBurden = whatPercentOfPay.is(25000);
const tvSubscriptionBurden = whatPercentOfPay.is(20000);
Declaratively compute the percentage of any value
(String)
A string representing the percentage you want to calculate. e.g '7.5%'
Object
:
An object on which you can call an "of" function with the figure you want the percentage computed for. Calling the "of" function returns the final computed percentage value
const salary = 1000000;
const vat = whatIs('7.5%').of(salary);
Makes it super easy to build your estimation as a list of sequencial function that all take an input, which could be coming from the previously called function in the sequence, and returns an output which might be the final estimation or one that gets passed to the next function in the sequence
(...Function)
Function
:
A single function that calls your sequence of chained functions with the input data it receives
const stepOne = ({data}) => {};
const stepTwo = ({data}) => {};
const stepThree = ({data}) => {};
const covid19ImpactEstimator = data => {
const estimatorFactory = chain(stepOne, stepTwo, stepThree);
return estimatorFactory({data});
}
const lagosNG = {reportedCases: 111, ...};
const estimate = onCovid19(lagosNG, covid19ImpactEstimator)
.estimateImpactAfter(30)
.days();