Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
[![Build](https://github.com/chauchakching/bisect-any/actions/workflows/build.yml/badge.svg)](https://github.com/chauchakching/bisect-any/actions/workflows/build.yml) [![Version](https://img.shields.io/npm/v/bisect-any.svg)](https://www.npmjs.com/package/
Like git-bisect, but on arbitrary function or command to find the "bad" value.
# install globally
npm install -g bisect-any
# help
bisect-any --help
Run a default export function from a js file with bisect values
E.g. To find the first integer that it's square is larger than 300 (answer: 18)
Example js function test/isSquareLessThan300.js
bisect-any --file test/is-square-less-than300.js 1 100
# Running bisect......
# Found value: 18
# {
# totalRounds: 8,
# records: [
# { goodVal: 1, badVal: 100 },
# { goodVal: 1, badVal: 50 },
# { goodVal: 1, badVal: 25 },
# { goodVal: 13, badVal: 25 },
# { goodVal: 13, badVal: 19 },
# { goodVal: 16, badVal: 19 },
# { goodVal: 17, badVal: 19 },
# { goodVal: 17, badVal: 18 }
# ]
# }
Run a CLI command with bisect values. If the command exit with non-zero code, it's considered a bad value.
Use %
as placeholder of bisect value in command string.
Example js program test/is-square-less-than300.js
bisect-any --command "node test/is-square-less-than300.js %" 1 100
const { bisect } = require('bisect-any')
(async () => {
const [result, report] = await bisect({
start: 1,
end: 100,
check: (val) => {
return val ** 2 <= 300;
},
})
})()
/**
* result === 18
*
* report == {
* totalRounds: 8,
* records: [
* { goodVal: 1, badVal: 100 },
* { goodVal: 1, badVal: 50 },
* { goodVal: 1, badVal: 25 },
* { goodVal: 13, badVal: 25 },
* { goodVal: 13, badVal: 19 },
* { goodVal: 16, badVal: 19 },
* { goodVal: 17, badVal: 19 },
* { goodVal: 17, badVal: 18 }
* ]
* }
FAQs
[![Build](https://github.com/chauchakching/bisect-any/actions/workflows/build.yml/badge.svg)](https://github.com/chauchakching/bisect-any/actions/workflows/build.yml) [![Version](https://img.shields.io/npm/v/bisect-any.svg)](https://www.npmjs.com/package/
The npm package bisect-any receives a total of 0 weekly downloads. As such, bisect-any popularity was classified as not popular.
We found that bisect-any demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.