abstract-scheduler
Advanced tools
Comparing version 2.0.0 to 3.0.0
14
index.js
@@ -22,9 +22,13 @@ 'use strict' | ||
const scheduler = createScheduler([]) | ||
t.plan(3) | ||
t.plan(5) | ||
t.equal(typeof scheduler.add, 'function', 'scheduler.add should be a function') | ||
t.equal(scheduler.add.length, 1, 'scheduler.add.length should be 1') | ||
let res1, res2 | ||
t.doesNotThrow(() => { | ||
scheduler.add('foo') | ||
res1 = scheduler.add('foo') | ||
res2 = scheduler.add('bar') | ||
}, `scheduler.add('foo') should work`) | ||
t.equal(res1, 0, 'the 1st scheduler.add() should have returned 0') | ||
t.equal(res2, 1, 'the 2nd scheduler.add() should have returned 1') | ||
}) | ||
@@ -42,7 +46,7 @@ | ||
t.doesNotThrow(() => { | ||
res1 = scheduler.remove('foo') | ||
}, `scheduler.remove('foo') should work`) | ||
res1 = scheduler.remove(0) | ||
}, `scheduler.remove(0) should work`) | ||
t.equal(res1, true, 'scheduler.remove should return true for a known item') | ||
const res2 = scheduler.remove('bar') | ||
const res2 = scheduler.remove(1) | ||
t.equal(res2, false, 'scheduler.remove should return false for an unknown item') | ||
@@ -49,0 +53,0 @@ }) |
{ | ||
"name": "abstract-scheduler", | ||
"description": "An interface and test suite to implement various scheduling algorithms.", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
@@ -62,7 +62,7 @@ # abstract-scheduler | ||
Add a value to the scheduler. | ||
Add a value to the scheduler. Returns the (`0`-based) index of the stored value. | ||
### `scheduler.remove(value)` | ||
### `scheduler.remove(i)` | ||
Remove a value from the scheduler. Returns `true` if the value was in the scheduler and `false` if it wasn't. | ||
Remove a value by (`0`-based) index. Returns `true` if the scheduler contained value, `false` otherwise. | ||
@@ -69,0 +69,0 @@ ### `scheduler.has(value)` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8225
104
0