A wrapper for JavaScript arrays useful for making comparison functions more readable.
npm install comparison-wrapperA wrapper for JavaScript arrays useful for making comparison functions more readable.
Given an array arr and a comparison function compareFunction we generate the
wrapper by executing for example
```
import {getComparisonWrapper} from "comparison-wrapper"
var e = getComparisonWrapper(compareFunction);getComparisonWrapper
You can assign the result of to any variable you want. `
However, consider this example we could use it as follows``
if (e(arr[i], "<=", arr[j])) {
//do something
}
if (e(arr[i], "<", arr[j])) {
//do something
}
if (e(arr[i], ">", arr[j])) {
//do something
}
if (e(arr[i], ">=", arr[j])) {
//do something
}