Sha256: bb0781ca33ac176b0d7f26e31fb63160980a1d7002148ebeaaa111911c69550b
Contents?: true
Size: 804 Bytes
Versions: 41
Compression:
Stored size: 804 Bytes
Contents
var List = require('../common/List'); module.exports = function createConvertors(walk) { return { fromPlainObject: function(ast) { walk(ast, { enter: function(node) { if (node.children && node.children instanceof List === false) { node.children = new List().fromArray(node.children); } } }); return ast; }, toPlainObject: function(ast) { walk(ast, { leave: function(node) { if (node.children && node.children instanceof List) { node.children = node.children.toArray(); } } }); return ast; } }; };
Version data entries
41 entries across 31 versions & 9 rubygems