summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/unist-util-remove-position/index.js
blob: 4db10234be92bc796e628cf5145ca627e6cc1d71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

var visit = require('unist-util-visit');

module.exports = removePosition;

/* Remove `position`s from `tree`. */
function removePosition(node, force) {
  visit(node, force ? hard : soft);
  return node;
}

function hard(node) {
  delete node.position;
}

function soft(node) {
  node.position = undefined;
}