The mock data can be used as plain JSON or as JavaScript objects.
Raw JSON
const employees = require("@jsdevtools/static-mock-data/employees.json");for (let employee of employees) { console.log(employee.dob); // date string console.log(employee.portrait); // relative file path}
JavaScript Objects
const mockData = require("@jsdevtools/static-mock-data");for (let employee of mockData.employees) { console.log(employee.dob); // Date object console.log(employee.portrait); // absolute file path}
Browser support
Static Mock Data supports recent versions of every major web browser. Older browsers may require Babel and/or polyfills.
To use Static Mock Data in a browser, you'll need to use a bundling tool such as Webpack, Rollup, Parcel, or Browserify. Some bundlers may require a bit of configuration, such as setting browser: true in rollup-plugin-resolve.
Employees
mockData.employees is an array of objects with the following properties:
Property
Data Type
Description
username
string
A alphanumeric username that is unique for each employee
password
string
An alphanumeric password
name.first
string
First name
name.last
string
Last name
gender
string
"male" or "female"
portrait
string
The path of the full-size portrait photo
thumbnail
string
The path of the thumbnail-size portrait photo
Projects
mockData.projects is an array of objects with the following properties:
Property
Data Type
Description
id
number
Numeric ID that is unique for each project
name
string
Project name that is unique for each project. 55 characters max.
description
string
Long project description. 2000 characters max
department
string
"Accounting", "Sales", "Human Resources", or "Marketing"
startedOn
Date
Date that the project started
endedOn
Date or null
Date that the project ended, or null if still ongoing