index.js 279 B

123456789101112131415161718
  1. 'use strict'
  2. var visit = require('unist-util-visit')
  3. module.exports = removePosition
  4. function removePosition(node, force) {
  5. visit(node, force ? hard : soft)
  6. return node
  7. }
  8. function hard(node) {
  9. delete node.position
  10. }
  11. function soft(node) {
  12. node.position = undefined
  13. }