New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ops-per-sec

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ops-per-sec

Quickly test ops per second of a function

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

ops-per-sec NPM version js-standard-style

Quickly test ops per second of a function

Warning - eval like stuff going on in cli yo

When using the cli your string will be interpreted using Node's vm in a sandboxed context. I'm no expert on the dangers of that, but it's always better to be safe than sorry. Don't be dumb with that.

"eval is evil" - some smart dude

Install

node

$ npm install --save ops-per-sec

cli

$ npm install -g ops-per-sec

Usage

const opsPerSec = require('ops-per-sec')
let ops = opsPerSec(() => ['some', 'text', 'in'].includes('text'), 3000, true)
console.log(`${ops} ops/sec`)
$ ops-per-sec "() => ['some', 'text', 'in'].includes('text')" 3000 true

API

opsPerSec(*func, *expect, *runForMs)

  • func [function - required] function to test ops per second for
  • runForMs [integer - optional - default: 5000] time in ms to let function run
  • expect [optional] value you expect to be returned from function

License

MIT © Andrew Carpenter

Keywords

ops

FAQs

Package last updated on 11 Feb 2020

Did you know?

Socket

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.

Install

Related posts