Faker.js生成随机path不起作用
我使用faker.js https://www.npmjs.com/package/faker来生成随机数据 。 它工作正常,虽然当我尝试创build一个这样的path
faker.system.directoryPath() + '/' + faker.system.filePath()
我一直都没有定义 ,所以它似乎存在,但不返回任何东西。
有没有人使用过这些方法之一?
在此先感谢,任何帮助将非常感激。
再见
这些function没有实现 – 看看https://github.com/Marak/faker.js/blob/master/lib/system.js#L132和https://github.com/Marak/faker.js/斑点/主/ LIB / system.js#L141
/** * not yet implemented * * @method faker.system.filePath */ this.filePath = function () { // TODO };
一些概念的certificate如何实现:
var faker = require('faker'); var path = require('path'); faker.directoryPath = function() { return path.format({base: faker.fake("{{random.words}}").replace(/ /g, path.sep).toLowerCase()}) } console.log(faker.directoryPath() + path.sep + faker.system.fileName()) // eg avon\re-engineered\strategist_gorgeous_wooden_fish_cambridgeshire.sm