Skip to content

syntax-tree/hast-util-script-supporting

Repository files navigation

hast-util-script-supporting Build Status Coverage Status

Check if a node is a script-supporting element.

Installation

npm:

npm install hast-util-script-supporting

hast-util-script-supporting is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

Dependencies:

var scriptSupporting = require('hast-util-script-supporting');

Given a non-script-supporting value:

var result = scriptSupporting({
    'type': 'element',
    'tagName': 'a',
    'properties': {
        'href': '#alpha',
        'title': 'Bravo'
    },
    'children': [{
        'type': 'text',
        'value': 'Charlie'
    }]
});

Yields:

false

Given a script-supporting element:

result = scriptSupporting({
    'type': 'element',
    'tagName': 'template',
    'children': [{
        'type': 'text',
        'value': 'Delta'
    }]
});

Yields:

true

API

scriptSupporting(node)

Check if the given value is a script-supporting element.

Parameters: node (*) — Value to check.

Returns: boolean, whether node passes the test.

License

MIT © Titus Wormer

About

utility to check if a node is a script-supporting element

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •