Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @travi/any with all npm packages installed. Try it out:

var any = require("@travi/any")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@travi/any v2.0.12

random data generator for when test data is insignificant

Random data generator

Build Status Coverage Status

Random data generator for when test data is insignificant. Tailoring data too closely for the domain can end up being confusing in tests because it distracts from the behavior that is actually important in the test. This is why I prefer to make it very clear when test data is insignificant by using a data generator. This library captures most of the patterns I use frequently.

Based on Chance.js

To save myself from needing to maintain the actual data generators, this library leverages Chance.js for generating the data. So why not just use Chance.js directly?

  • I find it annoying that an instance of Chance has to be created. Rather than initialize an instance in every module, I wrap a single instance for reuse throughout the tests.
  • I can set my default options to align with my typical conventions rather than having to repeatedly configure Chance.js's very flexible API
  • Lots of my tests need objects to be generated, but the structure of those objects typically does not matter. Chance.js does not have a simple-object generator, so I've included that on my own.
  • Many of my tests need lists generated. Like objects, Chance.js does not generate lists, so I've included this on my own.


npm monthly downloads license Try @travi/any on RunKit


$ npm install @travi/any --save-dev



PRs Welcome Conventional Commits Commitizen friendly semantic-release Renovate


$ nvm install
$ npm install


$ npm test
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free