package
Static mock data for sample apps, demos, and POCs
npm install static-mock-dataGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 2 packages.
7.8 MB
Includes dependencies.
Static mock data (as opposed to randomly-generated mock data) for sample apps, demos, and POCs.
npm install @jsdevtools/static-mock-dataThe mock data can be used as plain JSON or as JavaScript objects.
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
}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
}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.
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 |
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 |
assigned | array of strings |
Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.
To build the project locally on your computer:
Clone this repo
git clone https://github.com/JS-DevTools/static-mock-data.git
Install dependencies
npm install
Run the build script
npm run build
Run the tests
npm test
All JSON data is MIT licensed and can be used however you want.
All images (employee portraits) are licensed under Creative Commons BY-NC-SA 4.0 and have some limitations on their use.
See the LICENSE file for more details.
Thanks to these awesome companies for their support of Open Source developers ❤
jamesmessinger
james.messinger@gmail.com
email | string | Email address |
address.street | string | House number and street name |
address.city | string | City name |
address.state | string | U.S. state name (full name, not abbreviation) |
address.zip | string | U.S. zip code, in the format ##### |
phones | array of objects | Array of phone objects |
phones[].type | string | "home", "office", or "cell" |
phones[].number | string | Phone number, in the format ###-##-#### |
ssn | string | U.S. Social Security Number, in the format ###-##-####. Unique for each employee. |
dob | Date | Date of birth |
hiredOn | Date | Date the employee was hired |
terminatedOn | Date or null | Date the employee was terminated, or null if still employed |
department | string | "Accounting", "Sales", "Human Resources", or "Marketing" |
roles | array of strings | Array of roles, such as "employee", "consultant", "part time", etc. |
| Array of usernames of employees who are assigned to the project. Projects will only have employees from the same department. |