Skip to content

Instantly share code, notes, and snippets.

View tewnut's full-sized avatar

Phong Nguyen tewnut

View GitHub Profile
@ignlg
ignlg / example.js
Last active October 21, 2018 15:05
Fixes "TypeError: JSON.stringify cannot serialize cyclic structures" error when exporting to JSON a KeystoneJS model/list including virtuals.
var modelCleanCyclic = require('./modelCleanCyclic');
var Example = new keystone.List('Example', {});
Example.schema.set('toJSON', {
virtuals: true,
transform: modelCleanCyclic.transformer
});