remark-lint/test/clean.js
2015-06-11 18:07:00 +02:00

43 lines
709 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer. All rights reserved.
* @module Clean
* @fileoverview mdast plug-in used to remove positional
* information from mdasts syntax tree.
* @todo Externalise into its own repository.
*/
'use strict';
/*
* Dpendencies.
*/
var visit = require('../lib/utilities/visit');
/**
* Delete the `position` key for each node.
*
* @param {Node} ast - Root node.
*/
function transformer(ast) {
visit(ast, function (node) {
node.position = undefined;
});
}
/**
* Return `transformer`.
*
* @return {Function} - See `transformer`.
*/
function attacher() {
return transformer;
}
/*
* Expose.
*/
module.exports = attacher;