{"id":16578016,"url":"https://github.com/glynnbird/datamaker","last_synced_at":"2025-05-08T00:32:46.844Z","repository":{"id":32976319,"uuid":"147697976","full_name":"glynnbird/datamaker","owner":"glynnbird","description":"Data generator command-line tool and library. Create JSON, CSV, XML data from templates.","archived":false,"fork":false,"pushed_at":"2024-10-10T12:09:21.000Z","size":501,"stargazers_count":27,"open_issues_count":3,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-18T17:08:15.792Z","etag":null,"topics":["cli","csv","data-generation","json","nodejs","xml"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glynnbird.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-06T15:54:25.000Z","updated_at":"2025-02-11T21:34:14.000Z","dependencies_parsed_at":"2024-10-26T20:29:04.494Z","dependency_job_id":"3f6d176b-c3f1-4c27-b2af-0ead7e8c14ba","html_url":"https://github.com/glynnbird/datamaker","commit_stats":{"total_commits":75,"total_committers":6,"mean_commits":12.5,"dds":"0.21333333333333337","last_synced_commit":"03b1565bdc8028fc98f4ffa9f1240e14cd9ec130"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fdatamaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fdatamaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fdatamaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glynnbird%2Fdatamaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glynnbird","download_url":"https://codeload.github.com/glynnbird/datamaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978352,"owners_count":21834907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","csv","data-generation","json","nodejs","xml"],"created_at":"2024-10-11T22:12:53.288Z","updated_at":"2025-05-08T00:32:46.786Z","avatar_url":"https://github.com/glynnbird.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datamaker\n\nA command-line Node.js script and library that generates JSON or CSV data in bulk. If you are building an IT system, \nthen the chances are you'll need to populate a database (whether SQL or NoSQL) with some reasonably realistic data\nto test and benchmark with.\n\nThe *datamaker* tool allows sample data to be created by supplying:\n\n- a template of how the data is to look. The data can contain multiple placeholders where sample data will be inserted e.g. `{{firstname}},{{lastname}},{{date}}`.\n- the format of the output data: `none`, `json` or `csv`. This effects how the generated string data is processed prior to delivery.\n- the number of records to be created.\n\nQuick example:\n\n```sh\n$ echo \"{{uuid}},{{date}},{{firstname}} {{surname}},{{email}}\" | datamaker --format csv --iterations 5\n10U9SHHE2463IH9E,1970-10-12,Marylee Dodge,meagan-harwell@betaine.com\n379QYC80U5KYQP4D,1994-11-09,Melany Fuqua,jennette.labonte@yahoo.com\nDERC4Y2BQ6HCI0HI,1983-08-11,Cathleen Leal,earlenemattson@gmail.com\n00K8FEGZJO31Q08O,2005-06-18,Louie Lee,tonisha.short@hotmail.com\nJDYSVPTAEXKEF9D8,1982-10-29,Dionne Vann,martin.renfro@hemicrane.com\n```\n\n## Pre-requisites\n\n[Node.js \u0026 npm](https://nodejs.org/en/) are required to be pre-installed. \n\n## Installation\n\nTo install the command-line utility, use `npm`:\n\n```sh\n$ npm install -g datamaker\n```\n\nor add the library to an existing Node.js project:\n\n```sh\n$ npm install --save datamaker\n```\n\n## Command-line parameters reference\n\n- `--template`/`-t` - the path of the template file e.g `--template /path/to/template.txt`\n- `--format`/`-f` - the target file format (`none`, `csv`, `json` or `xml`). Default `none` e.g. `--format json`\n- `--iterations`/`-i` - the number of records to create. Default `1` e.g. `--iterations 5000`\n- `--list`/`-l` - list the available tags \n\n## Generating CSV files\n\nThe template for a CSV file can be stored in a text file and supplied with the `--template/-t` parameter. Create a text file containing the following template:\n\n```\n{{uuid}},{{date}},{{time}},{{firstname}} {{surname}},{{street}},{{town}},{{zip}} {{statecode}},{{longitude}},{{latitude}}\n```\n\nThe template contains the layout of each line of data, with placeholders for where the dynamic data is inserted. Save it as `template.txt`.\n\nYou may now run `datamaker` using this template:\n\n```sh\n$ datamaker -t ./template.txt -f csv -i 500\n```\n\nAlternatively, you can pipe in the template from elsewhere:\n\n```sh\n$ echo \"{{uuid}},{{date}},{{firstname}} {{surname}},{{zip}}\" | datamaker --format csv --iterations 10000 \n```\n\n## Generating JSON data\n\nJSON data is generated in a similar way. This time our template represents a single JSON document:\n\n```js\n{\n  \"_id\": \"{{uuid}}\",\n  \"name\": \"{{firstname}} {{surname}}\",\n  \"occupation\": \"{{occupation}}\",\n  \"religion\": \"{{religion}}\",\n  \"dob\": \"{{date 2014-01-01}}\",\n  \"status\": \"{{oneofl ok provisional rejected cancelled deleted}}\",\n  \"accountType\": \"{{oneof bronze silver gold}}\",\n  \"password\": \"{{password | sha256}}\",\n  \"salt\": \"{{ words 5 | sha512}}\",\n  \"lastIP\": \"{{ ip }}\",\n  \"lastLogin\": \"{{date_iso 2020-01-01}}\",\n  \"location\": {\n    \"longitude\": \"{{ longitude NYC }}\",\n    \"latitude\": \"{{ latitude NYC }}\"\n  },\n  \"address\": {\n    \"street\": \"{{street}}\",\n    \"town\": \"{{town}}\",\n    \"postode\": \"{{postcode}}\"\n  },\n  \"telephone\": \"{{tel}}\",\n  \"pets\": [\"{{cat}}\",\"{{dog}}\"],\n  \"email\": \"{{email true}}\",\n  \"url\": \"{{website}}\",\n  \"description\": \"{{words 20}}\",\n  \"((loop children 4))\":\"{{firstname}}\",\n  \"((loop friends 3))\": {\"name\": \"{{name}}\", \"email\": \"{{email}}\"}\n}\n```\n\nSave the template as `template.json`.\n\nRun the `datamaker` as before but with `json` as the format parameter:\n\n```sh\n$ datamaker -t ./template.json -f json -i 500 \n{\"_id\":\"e87691f3232e493a8f7d5ed866bbf813\",\"name\":\"Gertrude Ashcraft\",\"occupation\":\"Television production assistant\",\"religion\":\"Jeung San Do\",\"dob\":\"2022-06-17\",\"status\":\"cancelled\",\"accountType\":\"silver\",\"password\":\"6ae95ca5f8098007fc09f75761e85d4d1f6c9dc16e3f1679de4196127b0387b7\",\"salt\":\"ccf2adf7bd7590eb2444c2ca0393805c534f60686c877b0a12c32dc645f9006d8ea3df9aeb0ebbeba941bb9cc54b3f6688b614ccfbcfa6954f86ba66fbec76e5\",\"lastIP\":\"83.118.14.45\",\"lastLogin\":\"2022-06-09T13:25:44.406Z\",\"location\":{\"longitude\":\"-73.9759\",\"latitude\":\"40.7312\"},\"address\":{\"street\":\"6681 Shipley\",\"town\":\"Caister on Sea\",\"postode\":\"RH5 7XD\"},\"telephone\":\"+597-4041-660-496\",\"pets\":[\"Rusty\",\"Roxy\"],\"email\":\"gertrude.ashcraft6@hotmail.com\",\"url\":\"https://toronto.com\",\"description\":\"bedding insertion advisory bunch terms manual language parameter gs jurisdiction experiment signing gratuit cheapest initiative kai proxy anniversary prescribed penetration\",\"children\":[\"Idalia\",\"Allyson\",\"Jadwiga\",\"Luci\"],\"friends\":[{\"name\":\"Dalila Dunbar\",\"email\":\"judi.laughlin@friend.com\"},{\"name\":\"Tambra Caraway\",\"email\":\"virgil_cornell@vitamin.nr\"},{\"name\":\"Cathleen Rivero\",\"email\":\"kathleen_card54@gmail.com\"}]}\n...\n```\n\n### Loops\n\nOnly in JSON-Templates you may use the loop-command to create an Array of data.\n\nUsage:  \n```json\n\"((loop property number[,max]))\":{}\n```\n\n- property will be the name of the array\n- number is the number of times to repeat the object into the resulting array. if used with a second number, a random number between these two will be used, eg. `\"((loop tags 2,9))\": \"{{word}}\"`\n\nExample:  \n```json\n{\n  \"((loop items 2))\": {\n    \"name\":\"{{word}}\",\n    \"price\":\"{{price}}\"\n  }\n}\n```\n\nresults in\n\n```json\n\n{\n  \"items\": [\n    {\n      \"name\":\"some\",\n      \"price\":\"2.50\"\n    },\n    {\n      \"name\":\"item\",\n      \"price\":\"4.30\"\n    }\n  ]\n}\n```\n\n\u003e Note: to use the `((loop .. ))` syntax, you must be using JSON mode (i.e. `-f json` and the template itself must parse as JSON correctly, which in practice means using no generated numbers or boolans).\n\n## Generating XML data\n\nCreate an XML template e.g. `template.xml`:\n\n```\n\u003c?xml version=\"1.0\"?\u003e\n\u003ccompany\u003e\n  \u003cname\u003e{{company}}\u003c/name\u003e\n  \u003caddress\u003e\n    \u003cstreet\u003e{{street}}\u003c/street\u003e\n    \u003ccity\u003e{{city}}\u003c/city\u003e\n    \u003cstate\u003e{{state}}\u003c/state\u003e\n    \u003czip\u003e{{statecode}}{{zip}}\u003c/zip\u003e\n  \u003c/address\u003e\n  \u003cceo\u003e{{firstname}} {{surname}}\u003c/ceo\u003e\n  \u003cdateCreated\u003e{{date}}\u003c/dateCreated\u003e\n\u003c/company\u003e\n```\n\nRun the datamaker as before but with `xml` as the format parameter:\n\n\n```sh\n$ datamaker -t ./template.xml -f xml -i 500 \n\u003c?xml version=\"1.0\"?\u003e\u003ccompany\u003e  \u003cname\u003eConsulting \u003c/name\u003e  \u003caddress\u003e    \u003cstreet\u003e5270 Bispham Lane\u003c/street\u003e    \u003ccity\u003eSaint Louis\u003c/city\u003e    \u003cstate\u003eAlabama\u003c/state\u003e    \u003czip\u003eAZ83647\u003c/zip\u003e  \u003c/address\u003e  \u003cceo\u003eJefferey Harvey\u003c/ceo\u003e  \u003cdateCreated\u003e2009-10-28\u003c/dateCreated\u003e\u003c/company\u003e\n...\n```\n\n## Using datamaker to import data into Cloudant/CouchDB\n\nCombining this tool with the [couchimport](https://www.npmjs.com/package/couchimport) utility allows data to be generated and imported into the a Cloudant/CouchDB database in one go:\n\n```sh\n$ datamaker -t ./template.json -f json -i 1000 | couchimport --db mydatabase\nReading data from stdin\nwritten {\"batch\":1,\"batchSize\":500,\"docSuccessCount\":500,\"docFailCount\":0,\"statusCodes\":{\"201\":1},\"errors\":{}}\nwritten {\"batch\":2,\"batchSize\":500,\"docSuccessCount\":1000,\"docFailCount\":0,\"statusCodes\":{\"201\":2},\"errors\":{}}\nImport complete\n```\n\nThe *couchimport* utility bundles the JSON into bulk API calls and posts them to the database via HTTP.\n\n## Filters\n\nA datamaker tag can also include optional filters by supplying strings after a `|` character e.g.\n\n```\n$ echo '{{ name | toUpperCase }}' | datamaker\nJANYCE MOE\n```\n\nFilters can be chained e.g.\n\n```\n$ echo '{{ words 5 | toUpperCase | toArray}}' | datamaker\n[\"BUDAPEST\",\"LICENSING\",\"GMC\",\"METHODOLOGY\",\"MEM\"]\n$ echo '{{ name | toLowerCase | sha256 }}' | datamaker\n76576efc53b4441d342acbca485457f948c1b97c4a2515a05ffc47aa524b5093\n```\n\n### Available filters\n\n- `toUpperCase`\n- `toLowerCase`\n- `toTitleCase`\n- `toArray`\n- `md5`\n- `sha1`\n- `sha256`\n- `sha512`\n- `base64`\n- `toString`\n- `toBool`\n- `toFloat`\n- `toInt`\n- `toObject`\n- `encodeURIComponent`\n- `escapeSingleQuotes` - replaces single single quotes withe two single quotes, handy when generating SQL.\n- `escapeDoubleQuotes` - replaces single double quotes with two double quotes.\n\nAdditionally for JSON formats, the following filters can be used within templates to output appropriate JSON datatypes:-\n\n- `toBool`\n- `toFloat`\n- `toInt`\n- `toObject`\n\nAs well as performing type conversion, these functions also \"eat\" up any double quotes around the host tag e.g.\n\n```js\n{\n  \"alive\": \"{{boolean 0.75 | toBool}}\",\n  \"count\": \"{{integer | toInt}}\",\n  \"score\": \"{{float | toFloat}}\"\n}\n```\n\nreturns:\n\n```js\n{\n  \"alive\": true,\n  \"count\": 10,\n  \"score\": 5.0\n}\n```\n\nwhich is useful for making both the original template and the resultant object parse as valid JSON.\n\n## Tag reference\n\nThe Mustache-style tags you may use are listed below. Some tags allow extra parameters to be supplied to affect the range of random data generated\n\nThe code for the tags can be found in the `plugins` folder of the source code.\n\n- A-E - [addressuk](#addressuk) [addressus](#addressus) [addressgerman](#addressgerman) [airport](#airport) [autoinc](#autoinc) [boolean](#boolean) [cat](#cat) [city](#city) [cityGerman](#cityGerman) [clf](#clf) [company](#company) [country](#country) [creditcard](#creditcard) [currency](#currency) [date](#date) [date_iso](#date_iso) [digits](#digits) [dog](#dog) [domainname](#domainname) [email](#email) [emojii](#emojii) [ethnicity](#ethnicity)\n- F-O - [file](#file) [firstname](#firstname) [float](#float) [http_method](#http_method) [http_path](#http_path) [http_query_string](#http_query_string) [http_reponse](#http_response) [integer](#integer) [ip](#ip) [ip6](#ip6) [kuuid](#kuuid) [kuuidr](#kuuidr) [last](#last) [latitude](#latitude) [letters](#letters) [longitude](#longitude) [mac](#mac) [marque](#marque) [monarch](#monarch) [name](#name) [normal](#normal) [occupation](#occupation) [oneof](#oneof) [oneofl](#oneofl)\n- P-T - [password](#password) [president](#president) [postcode](#postcode) [price](#state) [prime](#prime) [product](#product) [religion](#religion) [sic](#sic) [state](#statecode) [statecode](#statecode) [street](#street) [streetGerman](#streetGerman) [surname](#surname) [tel](#tel) [time](#time) [timestamp](#timestamp) [title](#title) [tld](#tld) [town](#town)\n- U-Z - [unit](#unit) [url](#url) [uuid](#uuid) [uuidv4](#uuidv4) [walk](#walk) [website](#website) [word](#) [words](#words) [youtube](#youtube) [zip](#zip)\n\n### {{addressuk}}\n\nSingle-line UK address.         \n\nParameters: none\n\ne.g.\n\n```\n{{addressuk}} ---\u003e 9315 Lancaster Circle, Haslingden, Nottinghamshire, HS15 6YD\n```\n\n### {{addressus}}\n\nSingle-line US address.         \n\nParameters: none\n\ne.g.\n\n```\n{{addressus}} ---\u003e 8184 Ambrose, Fontana, Minnesota, 44626\n```\n\n### {{addressgerman}}\n\nSingle-line German address.         \n\nParameters: none\n\ne.g.\n\n```\n{{addressgerman}} ---\u003e Bahnhofsstrasse 12, 80335 München\n```\n\n### {{airport}}\n\nThree-digit airport code.          \n\nParameters: none\n\ne.g.\n\n```\n{{airport}} ---\u003e MTK\n```\n\n### {{autoinc}}\n\nAuto-incrementing number.          \n\nParameters: \n\n- starting number (default 1)\n\ne.g.\n\n```\n{{autoinc 1000}} ---\u003e 1000\n{{autoinc}} ---\u003e 1001\n```\n\n### {{boolean}}\n\nBoolean value.\n\nParameters: \n\n- probability of being true (default 0.5)\n\ne.g.\n\n```\n{{boolean}} ---\u003e false\n{{boolean 0.95}} ---\u003e true\n```\n\n### {{cat}}\n\nCat name.\n\nParameters: none\n\ne.g.\n\n```\n{{cat}} ---\u003e Smokey\n```\n\n### {{city}}\n\nUS city name.\n\nParameters: none\n\ne.g.\n\n```\n{{city}} ---\u003e Fremont\n```\n\n### {{cityGerman}}\n\nGerman city name.\n\nParameters: none\n\ne.g.\n\n```\n{{cityGerman}} ---\u003e Berlin\n```\n\n### {{clf}}\n\nLog line in [Common Logfile Format](https://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format).\n\nParameters: none\n\ne.g.\n\n```\n{{clf}} ---\u003e 208.148.153.238 - lelah [29/Aug/2024:14:22:49 +0100] \"GET /reel/hip.html HTTP/1.0\" 200 71733\n```\n\n### {{company}}\n\nCompany name.\n\nParameters: none\n\ne.g.\n\n```\n{{company}} ---\u003e Venusian Software Corp\n```\n\n### {{country}}\n\nCountry name.\n\nParameters: none\n\ne.g.\n\n```\n{{country}} ---\u003e Lebanon\n```\n\n### {{county}}\n\nUK county name.\n\nParameters: none\n\ne.g.\n\n```\n{{county}} ---\u003e Derbyshire\n```\n\n### {{creditcard}}\n\nCredit card number.\n\nParameters: none\n\ne.g.\n\n```\n{{creditcard}} ---\u003e 6011867289904845\n```\n\n### {{currency}}\n\nCurrency code.\n\nParameters: none\n\ne.g.\n\n```\n{{currency}} ---\u003e USD\n```\n\n### {{date}}\n\nRandom date in YYYY-MM-DD format.\n\nParameters: \n\n- min - minimum date or 'now' if the timestamp is to be the current date (default '1970-01-01')\n- max - maximum date (default 'now')\n\ne.g.\n\n```\n{{date}} ---\u003e 1977-02-28\n{{date 2015-01-01}} ---\u003e 2018-08-02 // date after 2015-01-01\n{{date 2015-01-01 2016-01-01}} ---\u003e 2015-04-23 // date in 2015\n{{date now}} ---\u003e 2024-07-02 // the current date\n```\n\n### {{date_iso}}\n\nRandom date in ISO-8601 format.\n\nParameters: \n\n- min - minimum date or 'now' if the timestamp is to be the current date/time (default '1970-01-01')\n- max - maximum date (default 'now')\n\ne.g.\n\n```\n{{date_iso}} ---\u003e 2013-05-24T02:44:04.687Z\n{{date_iso 2015-01-01}} ---\u003e 2018-07-09T22:15:30.512Z // date after 2015-01-01\n{{date_iso 2015-01-01 2016-01-01}} ---\u003e 2015-04-21T18:08:33.979Z // date in 2015\n{{date_iso now}} ---\u003e 2024-07-02T10:55:52.002Z // the current date\n```\n\n### {{digits}}\n\nString of numerals.\n\nParameters: \n\n- numDigits (default 5)\n\ne.g.\n\n```\n{{digits}} ---\u003e 06984\n{{digits 8}} ---\u003e 61103920\n```\n\n### {{dog}}\n\nDog name.\n\nParameters: none\n\ne.g.\n\n```\n{{dog}} ---\u003e Lucky\n```\n\n### {{domainname}}\n\nDomain name.\n\nParameters: none\n\ne.g.\n\n```\n{{domainname}} ---\u003e yallaer.com\n```\n\n### {{email}}\n\nEmail address.\n\nParameters: \n\n- whether to use the previous firstname/surname for the email generation\n\ne.g.\n\n```\n{{email}} ---\u003e jermaine.buchanan@drilling.com\n\n# based on previous name\n{{name}} ---\u003e Sheba Arthur\n{{email true}} ---\u003e sheba21436@yes.etnedal.no\n```\n\n### {{emojii}}\n\nEmojii.\n\nParameters: \n\n- numChars - number of characters (default 1)\n\ne.g.\n\n```\n{{emojii}} ---\u003e 👦\n{{emojii 3}} ---\u003e 🌹⛔💺\n```\n\n### {{ethnicity}}\n\nEthnicity string.\n\nParameters: None\n\ne.g.\n\n```\n{{ethnicity}} ---\u003e Tuscan\n```\n\n### {{file}}\n\nGet a random line from a simple text-file, e.g.\n\n```\nline1\nanother line\nyeah\n```\n\nParameters:\n\n- filename - full path to the file (no default)\n\ne.g.\n\n```\n{{file /path/to/file.txt}} ---\u003e line1\n```\n\n### {{firstname}}\n\nHuman first name.\n\nParameters: \n\ne.g.\n\n```\n{{firstname}} ---\u003e Bethan\n```\n\n### {{float}}\n\nFloating point number.\n\nParameters: \n\n- min (default 1)\n- max (default 100)\n- decimalPlaces (default 4)\n\ne.g.\n\n```\n{{float}} ---\u003e 13.8592\n{{float 1000 2000 2}} ---\u003e 1750.06\n```\n\n### {{http_method}}\n\nHTTP method. Either GET/PUT/POST/DELETE/HEAD/COPY, much more likely to be GET.\n\nParameters: \n\n- n/a\n\ne.g.\n\n```\n{{http_method}} ---\u003e GET\n```\n\n### {{http_path}}\n\nHTTP path.\n\nParameters: \n\n- n/a\n\ne.g.\n\n```\n{{http_path}} ---\u003e /curious/ranch/viruses.html?barriers=AJEAZDLK65QFHKZ1\n```\n\n### {{http_query_string}}\n\nAn HTTP query string.\n\nParameters\n\n- None\n\ne.g.\n\n```\n{{http_query_string}} ---\u003e ?offering=26\u0026approaches=electricity\u0026unsigned=sectors\u0026actively=villa\u0026adam=81ZVYDTDPXQTSK4J\n```\n\n### {{http_response}}\n\nHTTP response code. Either 200/400/401/403/302/500, much more likely to be 200.\n\nParameters: \n\n- n/a\n\ne.g.\n\n```\n{{http_response}} ---\u003e 200\n```\n\n### {{integer}}\n\nInteger number.\n\nParameters: \n\n- min (default 1)\n- max (default 100)\n\ne.g.\n\n```\n{{integer}} ---\u003e 99\n{{integer 1000 2000}} ---\u003e 1523\n```\n\n### {{ip}}\n\nIP4 address.\n\nParameters: \n\n- local - boolean (whether to generate an IP in the 192.168.1 range or not)\n\ne.g.\n\n```\n{{ip}} ---\u003e 63.235.50.110\n{{ip true}} ---\u003e 192.168.1.58\n```\n\n### {{ip6}}\n\nIP6 address.\n\nParameters: \n\n- local - boolean (whether to generate an IP in the fc00::: range or not)\n\ne.g.\n\n```\n{{ip6}} ---\u003e 487d:375d:7bfe:b23b:d1e2:8934:cfb2:c17e\n{{ip true}} ---\u003e fc00:cefe:5dfc:14da:691d:b4bf:63ac:6d17\n```\n\n### {{kuuid}}\n\nTime-sortable, unique identifier. see [here](https://www.npmjs.com/package/kuuid)\n\nParameters: \n\n- min (optional) - minimum date\n- max (optional) - maximum date\n\ne.g.\n\n```\n{{kuuid}} ---\u003e 001g8LWk0Svk222Bd0Et0GeaBl1P1gkP\n{{kuuid 2010-01-01 2019-01-01}} ---\u003e 001eWhUE2HLix22HqmL5436NDm1p02X6\n```\n\n### {{kuuidr}}\n\nTime-sortable, unique identifier, but in reverse order. see [here](https://www.npmjs.com/package/kuuid)\n\nParameters: \n\n- min (optional) - minimum date\n- max (optional) - maximum date\n\ne.g.\n\n```\n{{kuuidr}} ---\u003e zzzwSGtT2o36oK17mC4R26dkHI1f1Xm0\n{{kuuid 2010-01-01 2019-01-01}} ---\u003e zzyTAKwG1uzH1N4Cl4xi1vZIE22oxrrT\n```\n\n### {{last}}\n\nThe last generate value of the supplied tag. This is used to re-use generated data elsewhere in your template.\n\nParameters:\n\n- tag - the name of the tag\n\ne.g.\n\n```\n{{last uuid}} ---\u003e HSFC5LQPCP84IVY7 (the last uuid that was generated by datamaker)\n```\n\n### {{latitude}}\n\nDecimal latitude.\n\nParameters: \n\n- city - one of `LON`, `NYC`, `TOK`, `SYD` or `PAR`. If omitted a latitude anywhere in the world will by returned.\n\ne.g.\n\n```\n{{latitude}} ---\u003e -54.4371\n{{latitude PAR}} ---\u003e 48.8823\n```\n\n### {{letters}}\n\nString of uppercase characters.\n\nParameters: \n\n- numLetters (default 5)\n\ne.g.\n\n```\n{{letters}} ---\u003e TVEHJ\n{{letters 10}} ---\u003e WOBOJRJFCU\n```\n\n### {{longitude}}\n\nDecimal longitude.\n\nParameters: \n\n- city - one of `LON`, `NYC`, `TOK`, `SYD` or `PAR`. If omitted a longitude anywhere in the world will by returned.\n\ne.g.\n\n```\n{{longitude}} ---\u003e 175.2526\n{{longitude PAR}} ---\u003e 2.3815\n```\n\n### {{mac}}\n\nMac address\n\nParameters: none\n\ne.g.\n\n```\n{{mac}} ---\u003e 23-0d-a3-3e-cf-d8\n```\n\n### {{marque}}\n\nCar manufacturer.\n\nParameters: none\n\ne.g.\n\n```\n{{marque}} ---\u003e Bugatti\n```\n\n### {{monarch}}\n\nKing or Queen.\n\nParameters: none\n\ne.g.\n\n```\n{{monarch}} ---\u003e Henry VIII\n```\n\n### {{occupation}}\n\nOccupation string.\n\nParameters: none\n\ne.g.\n\n```\n{{occupation}} ---\u003e Midwife\n```\n\n### {{oneof}}\n\nPicks one of supplied values with an equal chance of each value appearing. See also [oneofl](#oneofl).\n\nParameters: any number of strings\n\ne.g.\n\n```\n{{oneof Gryffindor Hufflepuff Ravenclaw Slytherin}} ---\u003e Slytherin\n```\n\n### {{oneofl}}\n\nPicks one of supplied values, items at the start of the list are much more likely to be returned. (the `l` in `oneofl` stands for \"Log\", as the `Math.log10` function is used to get a non-linear probability of returning array items.)\n\nParameters: any number of strings\n\ne.g.\n\n```\n{{oneofl complete new rejected cancelled }} ---\u003e complete\n```\n\nHere's the distribution of results:\n\n```sh\necho '{{oneofl a b c d e f g h i j k l m }}' | datamaker -i 10000 | sort | uniq -c\n2692 a\n1550 b\n1097 c\n 860 d\n 675 e\n 541 f\n 465 g\n 421 h\n 388 i\n 393 j\n 317 k\n 308 l\n 293 m\n```\n\n### {{name}}\n\nCombination for firstname and surname. Equivalent of `{{firstname}} {{surname}}`.\n\nParameters: none\n\ne.g.\n\n```\n{{name}} ---\u003e Anna Flint\n```\n\n### {{normal}}\n\nGenerates numbers on a normal distribution\n\nParameters: \n\n- mean - centre of distribution (default 50)\n- stddev - standard deviation (default 1)\n- decimalPlaces - number of decimal places (default 4)\n\ne.g.\n\n```\n{{normal}} ---\u003e 50.1097\n{{normal 20000 1000 2}} ---\u003e 20370.88\n```\n\n### {{password}}\n\nA commonly-used password.\n\nParameters: none\n\ne.g.\n\n```\n{{password}} ---\u003e abcd1234\n{{password | md5}} ---\u003e 1f3870be274f6c49b3e31a0c6728957f\n```\n\n### {{president}}\n\nA US president\n\nParameters: None\n\ne.g.\n\n```\n{{president}} ---\u003e Richard Nixon\n```\n\n### {{postcode}}\n\nUK postcode.\n\nParameters: none\n\ne.g.\n\n```\n{{postcode}} ---\u003e KT4 0XS\n```\n\n### {{price}}\n\nFloating point price.\n\nParameters: \n\n- min (default 1)\n- max (default 100)\n\ne.g.\n\n```\n{{price}} ---\u003e 65.29\n{{price 500 700}} ---\u003e 521.98\n```\n\n### {{prime}}\n\nPrime number. If you supply impossible parameters, you will get _1_ in reply.\n\nParameters: \n\n- min (default 1)\n- max (default 100)\n\ne.g.\n\n```\n{{prime}} ---\u003e 17\n{{prime 1000 3000}} ---\u003e 1657\n```\n\n### {{product}}\n\nProduct name. \n\nParameters: \n\n- None\n\ne.g.\n\n```\n{{product}} ---\u003e CARABAO\n{{product | toTitleCase}} ---\u003e Salt\n```\n\n### {{religion}}\n\nReligion\n\nParameters: none\n\ne.g.\n\n```\n{{religion}} ---\u003e Mandaean Nasaraean Sabeans\n```\n\n### {{sic}}\n\nIndustry standard SIC code - business category\n\nParameters: none\n\ne.g.\n\n```\n{{sic}} ---\u003e Growing of tobacco\n```\n\n### {{state}}\n\nUS state name.\n\nParameters: none\n\ne.g.\n\n```\n{{state}} ---\u003e Ohio\n```\n\n### {{statecode}}\n\n2-letter US state code.\n\nParameters: none\n\ne.g.\n\n```\n{{statecode}} ---\u003e NC\n```\n\n### {{street}}\n\nStreet address.\n\nParameters: none\n\ne.g.\n\n```\n{{street}} ---\u003e 6502 Chantler Avenue\n```\n\n### {{streetGerman}}\n\nGerman Street name.\n\nParameters: none\n\ne.g.\n\n```\n{{streetGerman}} ---\u003e Schulstrasse\n```\n\n### {{surname}}\n\nHuman surname.\n\nParameters: none\n\ne.g.\n\n```\n{{surname}} ---\u003e Doyle-Tyson\n```\n\n### {{tel}}\n\nInternational telephone number.\n\nParameters: none\n\ne.g.\n\n```\n{{tel}} ---\u003e +43-3040-100-474\n```\n\n### {{time}}\n\nTime in HH:MM:SS format.\n\nParameters: none\n\ne.g.\n\n```\n{{time}} ---\u003e 10:45:59\n```\n\n### {{timestamp}}\n\nTimestamp in milliseconds since 1970.\n\nParameters: \n\n- min - minimum timestamp (default 0)\n- max - maximum timestamp (default 'now')\n\ne.g.\n\n```\n{{timestamp}} ---\u003e 351543517819\n{{timestamp 946684800000}} --\u003e 1163308913102  // timestamp after 2000-01-01\n{{timestamp 946684800000 978307200000}} --\u003e 959753617250  // timestamp in year 2000\n```\n\n### {{title}}\n\nHonorific or title e.g. Mr, Mrs etc.\n\nParameters: none\n\ne.g.\n\n```\n{{title}} ---\u003e Reverend\n```\n\n### {{tld}}\n\nTop level domain, or common domain name ending.\n\nParameters: none\n\ne.g.\n\n```\n{{tld}} ---\u003e gov.pr\n```\n\n### {{town}}\n\nUK town name.\n\nParameters: none\n\ne.g.\n\n```\n{{town}} ---\u003e Dudley\n```\n\n### {{unit}}\n\nAn SI Unit\n\nParameters: none\n\ne.g.\n\n```\n{{unit}} ---\u003e °C\n```\n\n### {{url}}\n\nFull URL.\n\nParameters: none\n\ne.g.\n\n```\n{{url}} ---\u003e https://www.jovinianist.com/microcosmology.html?adrenalone=VEF0TSB23N04V8MO\n```\n\n### {{uuid}}\n\nUnique identifier.\n\nParameters: none\n\ne.g.\n\n```\n{{uuid}} ---\u003e C3QTU8YIVKZY126Q\n```\n\n### {{uuidv4}}\n\nUnique identifier v4.\n\nParameters: none\n\ne.g.\n\n```\n{{uuidv4}} ---\u003e d1e606b0-0452-46a7-9190-8671a82fdea0\n```\n\n### {{walk}}\n\nRandom walk. A single floating point number that \"walks\" in value between invocations.\n\nParameters:\n\n- start - the start value (Default: 0)\n- inc - the max increment (Default: 1)\n- places - the number of decimal places in the output (Default: 4)\n- ref - a reference for this value, so that multiple \"walk\" tags can be used in the same datamaker template (Default: ref)\n\ne.g.\n\n```\n{{walk}} ---\u003e -0.4405\n{{walk 50 0.5 6 x}} ---\u003e 50.099534\n{{walk -1.1 0.2 6 y}} ---\u003e -1.163953\n{{walk 50 0.5 6 x}} ---\u003e 50.311757\n{{walk -1.1 0.2 6 y}} ---\u003e -0.965426\n```\n\n### {{website}}\n\nFull website URL.\n\nParameters: none\n\ne.g.\n\n```\n{{website}} ---\u003e http://unlyrically.com\n```\n\n### {{word}}\n\nSingle word.\n\nParameters: none\n\ne.g.\n\n```\n{{word}} ---\u003e synentognathous\n```\n\n### {{words}}\n\nMultiple words.\n\nParameters: \n\n- count (default 5)\n\ne.g.\n\n```\n{{words}} ---\u003e piacularly burp archisymbolical glumaceous Calinago\n{{words 2}} ---\u003eXenomorpha mauler\n```\n\n### {{youtube}}\n\nRandom YouTube URL.\n\nParameters: none\n\ne.g.\n\n```\n{{youtube}} ---\u003e https://www.youtube.com/watch?v=dQw4w9WgXcQ\n```\n\n### {{zip}}\n\nUS ZIP code.\n\nParameters: none\n\ne.g.\n\n```\n{{zip}} ---\u003e 69882\n```\n\n## Using as a library\n\nYou can use this npm module as a library in your own code\n\n```js\nlet dg = require('datamaker')\nconst template = '{{title}} {{firstname}} {{surname}}'\nconst format = 'none'\nconst iterations = 500\ndg.generate(template, format, iterations)\n  .on('data', (d) =\u003e { console.log(d) })\n  .on('end', (d) =\u003e { console.error('Done!') })\n```\n\nor there are helper functions that return Promises e.g.\n\n```js\n// get a single item\nawait dg.single('{{uuid}},{{name}}', 'csv')\n// get a batch of 50 items\nawait dg.batch('{\"name\": \"{{name}}\",\"email\": \"{{email}}\"}', 'json', 50)\n```\n\n### Custom Plugins\n\nWhen using datamaker as a library it is possible to extend its capability by defining custom plugins to suit the individual needs of a project. A custom plugin should be located inside the `/datamaker/plugins/` folder at the root of the applications project with each plugin created as a separate js file within a `namespace` folder allowing plugins to referenced in templates as `{{namespace:plugin}}`. For example:\n\n```\ndatamaker\n└── plugins\n    └── myorg\n        └── employeeid.js\n```\n\nWith the custom `employeeid` plugin defined as follows:\n\n```js\nmodule.exports = () =\u003e {\n  const min = 1000000\n  const max = 3000000\n  return (Math.floor(min + Math.random() * (max - min))).toString()\n}\n```\n\nThe custom plugin can then be referenced in a template using `{{myorg:employeeid}}` as follows:\n\n```js\nlet dg = require('datamaker')\nconst template = '{{myorg:employeeid}} {{title}} {{firstname}} {{surname}}'\nconst format = 'none'\nconst iterations = 5\ndg.generate(template, format, iterations)\n  .on('data', (d) =\u003e { console.log(d) })\n  .on('end', (d) =\u003e { console.error('Done!') })\n```\n\nResulting in the following:\n\n```\n2286807 Mr Athena Bowles\n1727729 Prof Heidi Barrow\n2411511 Mr Lawanna Karr\n2898717 Mrs Londa Wingate\n1756263 Ms Lashay Pitre\n```\n\n## Formatting\n\nThe `--format`/`-f` parameter defines\n\n- how the text in each substition is pre-processed before output e.g. in `json` mode double quotes are escaped correctly.\n- how each line of output is processed prior to output e.g. in `json` mode the completed template is parsed to check it is valid JSON before being output on a a single line followed by a `\\n` character\n\nThe code for the formatters can be found in the `formatters` folder of the source code.\n\n## A note on the data\n\nThe data generated by this tool is biased towards UK and US data sets. The names, towns, streets and postcodes are gleaned from western data sets. If you need data that resembles a different geography or contains more challenging character sets, then the feel free to fork the code and modify the stock data from the `plugins` folder or follow the guidance above and add your own specific [custom plugins](#custom-plugins).\n\nNote that generating an address with `{{street}},{{city}},{{state}},{{statecode}}{{zip}}` will generate that appears at a glance to be a reasonble address, but is patently nonsense:\n\n```sh\n$ echo \"{{street}},{{city}},{{state}},{{statecode}}{{zip}}\" | datamaker\n6682 Crowcroft Circle,Nashua,New York,UT00769\n```\n\nThe plugins do not coordinate with each other to ensure that the street exists in the city, or that the city exists in the state, or that the state code matches the state. That would require a more sophisticated and much larger data set!\n\nAlso note that the email addresses, zip codes, domain names, telephone numbers, websites and postcodes are fabricated. Airports, towns, states, state codes, cities, counties, countries and currencies are real.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglynnbird%2Fdatamaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglynnbird%2Fdatamaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglynnbird%2Fdatamaker/lists"}