Skip to content

Instantly share code, notes, and snippets.

Avatar

Phong Nguyen tewnut

View GitHub Profile
@ignlg
ignlg / example.js
Last active Oct 21, 2018
Fixes "TypeError: JSON.stringify cannot serialize cyclic structures" error when exporting to JSON a KeystoneJS model/list including virtuals.
View example.js
var modelCleanCyclic = require('./modelCleanCyclic');
var Example = new keystone.List('Example', {});
Example.schema.set('toJSON', {
virtuals: true,
transform: modelCleanCyclic.transformer
});
You can’t perform that action at this time.