Sha256: 291cdcdd2102def86efa99c674e41822d1c513ef8d1946c1230c1f0edf7e24c1
Contents?: true
Size: 791 Bytes
Versions: 1
Compression:
Stored size: 791 Bytes
Contents
'use strict' var convert = require('./convert') module.exports = is is.convert = convert // Assert if `test` passes for `node`. // When a `parent` node is known the `index` of node should also be given. function is(node, test, index, parent, context) { var check = convert(test) if ( index != null && (typeof index !== 'number' || index < 0 || index === Infinity) ) { throw new Error('Expected positive finite index') } if (parent != null && (!is(parent) || !parent.children)) { throw new Error('Expected parent node') } if ((parent == null) !== (index == null)) { throw new Error('Expected both parent and index') } return node && node.type && typeof node.type === 'string' ? Boolean(check.call(context, node, index, parent)) : false }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trusty-cms-6.3.1 | node_modules/unist-util-is/index.js |