Home Download Buy Blog Forum Support

FakeDataGenerator

FakeDataGenerator

Postby tito on Tue Jun 03, 2014 5:45 am

So, I was trying to generate a json with some great online tools such http://www.json-generator.com/ but sadly I had to repeat a property of an object, and none of the tool I tried where capable to do that. These are too smart about JSON. Then, I remembered that python library to generate fake data, Faker: https://github.com/joke2k/faker and quickly managed to create a package https://github.com/SublimeText/FakeDataGenerator

Now I can generate my fake json with object index with the following code..

Code: Select all
  "{{index()}}": {
    "name": "{{name()}}"
  },


1. Select text, CTRL+SHIFT+P for the command pallete, type "Fake it!", select to repeat 3 times, will produce:
Code: Select all
  "1": {
    "name": "Trina Friesen"
  },
  "2": {
    "name": "Mack Koch"
  },
  "3": {
    "name": "Burney O'Kon"
  },


Awesome :)

See the readme for more information https://github.com/SublimeText/FakeDataGenerator

Help Wanted / Infinite todo list:
- Would be very nice to allow generate "code blocks", such a for loop. For example:
Code: Select all
... "{{index()}}": {
    "tags": [
        {{for i in range(0,4)}}
           {"tag": "{{word()}}", "date": "{{date()}}", "etc": "life to short"},
        {{/for}}
    ]
  } ...


Someone wants to take that !??
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: FakeDataGenerator

Postby iamntz on Tue Jun 03, 2014 10:24 am

Whoa, awesome! A quick idea: since there are so many methods, you should add them into command pallete (e.g. fake:name fake:email and so on)
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: FakeDataGenerator

Postby tito on Tue Jun 03, 2014 8:13 pm

Yes though that.. then went to sleep :P, now updated to include the commands.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot] and 8 guests