Version
Current pre-alpha 0.7.2 Release is pre-alpha
Install
> npm i -S paracetamol
About
Declarative checking arguments in your function. Possible wrap and runtime syntax Added function profiling
You need any function where should be strong-type arguments
let { return string + '(' + number + ')';};
Variant A: Declare and wrap
1.Declare arguments and wrap your function
fn = ;
2. Call it
// Normal run;;; // Throw TypeError;;;
Variant B. RunTime assert
let { $p; $p; return string + '(' + number + ')';};
Variant C. RunTime no throw assert
let { if $pNumber && $pString return string + '(' + number + ')'; else return null; };
Function Time, Memory, Result profiling
it possible only wrap syntax:
let { return Math;}; fn = ; for let i = 0; i < 16; ++i ; console;
Result:
Function "anonymous" has been called 16 timestotal calling time: 70uscompile time: 44usaverage calling time: 4ussum of memory diff: 18920average memory diff: 1182.5list of every call: P_TIME HR_TIME MEMORY_CHANGE ARGS => RESULT 52ms 44us 5696 => 1 52ms 56us 4072 => 4 52ms 1us 680 => 64 52ms 998ns 1656 => 4096 52ms 1us 568 => 1048576 52ms 964ns 568 => 1073741824 52ms 952ns 568 => 4398046511104 52ms 1us 568 => 72057594037927940 52ms 989ns 568 => 4.722366482869645e+21 52ms 975ns 568 => 1.2379400392853803e+27 52ms 920ns 568 => 1.298074214633707e+33 52ms 834ns 568 => 5.444517870735016e+39 52ms 832ns 568 => 9.134385233318143e+46 52ms 823ns 568 => 6.129982163463556e+54 52ms 815ns 568 => 1.645504557321206e+63 52ms 812ns 568 => 1.7668470647783843e+72
Release Notes:
0.0.1:
- Initial work concept
0.7.1:
- Initial modular build: declarations factory (store), assert library, $p main function, definer, main point
- Api: Basic types:
Number
,String
,Symbol
,Bool
,Array
,Object
,Function
,Null
,Undef
- Api: Type classes:
Complex
,Scalar
,Any
,Defined
,Countable
)
0.7.2
- Api: Add new type class
Numeric
- Api: Numeric asserts types:
int
,float
,positive
,negative
- Testing chained calling declarations
$p.Numeric.int.positive(5);