Skip to content

Commit 212648f

Browse files
committed
Remove dependency
1 parent 8a7b3be commit 212648f

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

lib/omission/omission.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
'use strict';
22

3-
/* Dependencies. */
4-
var has = require('has');
5-
63
/* Expose. */
74
module.exports = omission;
85

6+
var own = {}.hasOwnProperty;
7+
98
/* Factory to check if a given node can have a tag omitted. */
109
function omission(handlers) {
1110
return omit;
1211

1312
/* Check if a given node can have a tag omitted. */
1413
function omit(node, index, parent) {
1514
var name = node.tagName;
16-
var fn = has(handlers, name) ? handlers[name] : false;
15+
var fn = own.call(handlers, name) ? handlers[name] : false;
1716

1817
return fn ? fn(node, index, parent) : false;
1918
}

lib/omission/opening.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
/* Dependencies. */
4-
var has = require('has');
54
var is = require('unist-util-is');
65
var element = require('hast-util-is-element');
76
var before = require('./util/siblings').before;
@@ -11,6 +10,8 @@ var whiteSpaceLeft = require('./util/white-space-left');
1110
var closing = require('./closing');
1211
var omission = require('./omission');
1312

13+
var own = {}.hasOwnProperty;
14+
1415
/* Construct. */
1516
module.exports = omission({
1617
html: html,
@@ -43,7 +44,7 @@ function head(node) {
4344
child.type === 'element' &&
4445
(name === 'title' || name === 'base')
4546
) {
46-
if (has(map, name)) {
47+
if (own.call(map, name)) {
4748
return false;
4849
}
4950

lib/one.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
'use strict';
22

3-
/* Dependencies. */
4-
var has = require('has');
5-
63
/* Expose. */
74
module.exports = one;
85

6+
var own = {}.hasOwnProperty;
7+
98
/* Handlers. */
109
var handlers = {};
1110

@@ -24,7 +23,7 @@ function one(ctx, node, index, parent) {
2423
throw new Error('Expected node, not `' + node + '`');
2524
}
2625

27-
if (!has(handlers, type)) {
26+
if (!own.call(handlers, type)) {
2827
throw new Error('Cannot compile unknown node `' + type + '`');
2928
}
3029

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"dependencies": {
2222
"ccount": "^1.0.0",
2323
"comma-separated-tokens": "^1.0.1",
24-
"has": "^1.0.1",
2524
"hast-util-is-element": "^1.0.0",
2625
"hast-util-whitespace": "^1.0.0",
2726
"html-void-elements": "^1.0.0",

0 commit comments

Comments
 (0)