From 8f1951a47fb5e0a410ac9a1ca69b9fe872e044ac Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sun, 7 Apr 2019 17:45:48 +0200 Subject: [PATCH] Add some more examples to the readme --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 62581cf..7e6e080 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,30 @@ To generate infinite records, use: - fromFile(fileName) - fromRegex(pattern) +### Examples + +Using `fromFile` and `oneOf`: + +``` +↪ mkjson --num 3 w="oneOf(fromFile('/usr/share/dict/words'))" +{"w":"Karl"} +{"w":"demographic"} +{"w":"calumny's"} +``` + +Nesting calls to create objects: + +``` +↪ mkjson obj=$(mkjson xs="array(randomInt(0, 4), randomInt(5, 9))") +{"obj":{"xs":[2,5]}} +``` + +Using `object` with various providers: + +``` +↪ mkjson obj="object(dt, randomDateTime(), type, fromRegex('[a-z]{4}-\d+'), xs, replicate(5, randomInt(0, 10)))" +{"obj":{"dt":"2099-09-11T16:33:41Z","xs":[6,8,5,2,0],"type":"ldwa-2667786160"}} +``` ## Installation