虚拟数据Dummy-Data允许您生成符合JSON规范的虚拟数据。

示例(基本):


var dummy = require('dummy-data');

var spec = {

  name: \"String\",

  age: { type: \"Integer\", max: 110, min: 0 },

  height: { type: \"Number\", max: 9, min: 0 },

  address: \"String\",

  date: { type: \"Date\", min: new Date(1960, 0), max: new Date() }

};

var person = dummy.generate(spec);

示例(嵌套对象):


var dummy = require('dummy-data');