fully-storage-faker-api
faker and a implement for fully-storage package
This API is a generator fixtures based onfully-storage is a simple no-sql data store with an HTTP session manager implemented.
fully-storage-faker-api is usable outside fully storage
installation
> npm install fully-storage-faker-api --save > yarn add fully-storage-faker-api
usage
const GeneratorFixtures = ; const faker = locality: 'en_US' { // state is fixtures object generated // you can push inside any storage here console; }; const numberObjectFixtures = 10; faker;
options
From the GeneratorFixtures
constructor or instance object you can define a arbitrary value for a options
attribute this data is transfert to your onAppend
method
e.g:
const GeneratorFixtures = ; const faker = locality: 'en_US' { console; }; // define a options object transfer to `onAppend` methodfakeroptionstable = "articles"; const numberObjectFixtures = 10; faker;
usage with fully-storage
fully-storage implement this API,
and auto add fixtures object
inside collection define by the options
attribute
fully-storage should implement a code equal to below
const GeneratorFixtures = ; const faker = locality: "en_US" onAppend: options state Storage; ;
User fully-storage should access to this usage:
const faker = fullyStorage; fakeroptions = collectionName: "articles" AUTO_SAVE_ID: fullyStorageAUTO_SAVE_ID; const numberArticlesFixtures = 10; faker;
extends faker.date.between
fully-storage-faker-api have extends the native method faker.date.between
for allow params time as string value.
with native code:
const from = ; // now const oneHours = 1000 * 60 * 60;const oneDay = onHours * 24; const _15days = oneDay * 15; // timestamp MS 15days const to = Date - _15Days; // 'now' - '15days' // random date between: now and now-15daysconst randomDate = fakerdate; console;
with extends:
const randomDate = fakerdate; console;