escss-estest
100% coverage makes your life easier.
Installation
npm install escss-estest
Idea
like a water filter
function foo() {
{
}
}
Usage
esTest(1, '<', 5)
esTest(5, '>', 1)
esTest(1, '<=', 5)
esTest(5, '>=', 1)
esTest(1, '!==', 2)
esTest(1, '===', 1)
esTest(1, '===', 100)
esTest(1, '===', 100, 'foo')
esTest(1, 'number')
esTest(1n, 'bigint')
esTest('foo', 'string')
esTest(true, 'boolean')
esTest([], 'array')
esTest({}, 'object')
esTest(NaN, 'NaN')
esTest(null, 'null')
esTest(undefined, 'undefined')
esTest(Symbol(), 'symbol')
esTest(function () {}, 'function')
esTest(1, 'object')
esTest(1, 'object', 'foo')
Examples
function sum(a, b, enable) {
{
esTest(a, 'number')
esTest(b, 'number')
}
return a + b
}
async function getData() {
const url = "https://jsonplaceholder.typicode.com/todos/1";
const response = await fetch(url);
const json = await response.json();
{
esTest(json.completed, 'boolean')
esTest(json.id, 'number')
esTest(json.title, 'string')
esTest(json.userId, 'number')
}
console.log(json);
}
License
Dual Licensing( Commercial or AGPL 3.0 ), see here to know more