2.0.0 • Published 7 years ago

mimic-it v2.0.0

Weekly downloads
13
License
MIT
Repository
github
Last release
7 years ago

npm

Versioning

This project follows semantic versioning.

Install

The ES6 version of mimic is hosted on NPM as 'mimic-it'.

There is no ES5 version at the moment - please just use babel or similar in your toolchain, with regenerator, if you need to run this on an older environment.

npm i -S mimic-it

or

yarn add mimic-it

Usage

// create a replayable iterator
const it = mimic(gen)

// you can specifying first steps
const it = mimic(gen, {
  prevCalls: [{ cmd: 'next', args: [2, 42] }, { cmd: 'throw', args: [new Error('oops')] }]
})

// ...and / or specify initial args passed to the generator
const it = mimic(gen, {
  initArgs: [42, 'secondArg']
})


// do stuff...
it.next()
// ... etc ...
// get a replayed iterator
const it2 = it.mimic()
// get a replayed iterator, specifying how many steps to replay
const it3 = it.mimic({ steps: 2 })
2.0.0

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago