Skip to content

Instantly share code, notes, and snippets.

View MichaelZaporozhets's full-sized avatar
🤠

Michael Zaporozhets MichaelZaporozhets

🤠
  • A Cloud Guru
  • Melbourne, Australia
  • X @mzapo7
View GitHub Profile
@flekschas
flekschas / conclusion.md
Created July 31, 2018 14:59
Performance of Object.keys vs Object.values for getting the number of props of an object

Results

Let's get started!
VM73:13 Object.keys took: 20234.000000054948msecs
VM73:19 Object.values took: 5987.800000002608msecs

Conclusion

@JedWatson
JedWatson / createItems.md
Last active September 17, 2019 02:41
Examples of how to use Keystone's createItems functionality

Populating Data in KeystoneJS

Keystone's createItems function is a simple but powerful way to populate your database with data.

It can be used to create test fixtures or initialise your database with default content / users / etc.

There's also a shorthand syntax that can be used within update files; if you are using the auto updates feature, any file that exports a create object will automatically be wrapped and the data will be created.

createItems takes two passes at the data it is passed, first creating the items and retaining references by key (if provided) that can be used to populate relationships in the second pass. This makes it easy to create related data without asynchronous nesting (which for data creation sometimes ends up in knots).