Skip to content

Commit 16fa612

Browse files
committed
Remove generated functionality
Use [`unist-util-generated`][generated] instead. [generated]: https://github.com/wooorm/unist-util-generated
1 parent e956866 commit 16fa612

File tree

4 files changed

+0
-61
lines changed

4 files changed

+0
-61
lines changed

index.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var position = exports;
55

66
position.start = positionFactory('start');
77
position.end = positionFactory('end');
8-
position.generated = generated;
98

109
/* Factory to get a position at `type`. */
1110
function positionFactory(type) {
@@ -22,12 +21,3 @@ function positionFactory(type) {
2221
};
2322
}
2423
}
25-
26-
/* Detect if a node was available in the original document. */
27-
function generated(node) {
28-
var initial = position.start(node);
29-
var final = position.end(node);
30-
31-
return initial.line === null || initial.column === null ||
32-
final.line === null || final.column === null;
33-
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"unist",
88
"node",
99
"position",
10-
"generated",
1110
"util",
1211
"utility"
1312
],

readme.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ var tree = remark().parse([
2525

2626
position.start(tree); //=> {line: 1, column: 1}
2727
position.end(tree); //=> {line: 4, column: 1}
28-
position.generated(tree); //=> false
2928

3029
position.start(); //=> {line: null, column: null}
3130
position.end(); //=> {line: null, column: null}
32-
position.generated(); //=> true
3331
```
3432

3533
## API
@@ -49,20 +47,6 @@ Get the position start or end position of `node`, respectively.
4947
[`Position`][position] — Filled with `line` (nullable `uint32 >= 1`),
5048
`column` (nullable `uint32 >= 1`), `offset` (nullable `uint32 >= 0`).
5149

52-
### `position.generated([node])`
53-
54-
Get the heading style of a node.
55-
56-
###### Parameters
57-
58-
* `node` ([`Node`][node]) — Node to check;
59-
60-
###### Returns
61-
62-
`boolean` — Whether or not `node` has positional information (both
63-
starting and ending lines and columns). This is useful when checking
64-
if a node is inserted by plug-ins.
65-
6650
## License
6751

6852
[MIT][license] © [Titus Wormer][author]

test.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,5 @@ test('unist-util-position', function (t) {
6363
});
6464
});
6565

66-
t.test('generated', function (st) {
67-
st.equal(
68-
position.generated(),
69-
true,
70-
'should not throw without node'
71-
);
72-
73-
st.equal(
74-
position.generated(properties),
75-
false,
76-
'should return false when with properties'
77-
);
78-
79-
st.equal(
80-
position.generated(objects),
81-
true,
82-
'should return true when without properties'
83-
);
84-
85-
st.equal(
86-
position.generated(values),
87-
true,
88-
'should return true when without objects'
89-
);
90-
91-
st.equal(
92-
position.generated(none),
93-
true,
94-
'should return true when without position'
95-
);
96-
97-
st.end();
98-
});
99-
10066
t.end();
10167
});

0 commit comments

Comments
 (0)