Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unist-util-select

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unist-util-select - npm Package Compare versions

Comparing version 1.5.0 to 2.0.0

lib/.DS_Store

50

index.js

@@ -1,40 +0,20 @@

'use strict';
'use strict'
var parseSelector = require('./lib/selector'),
matchSelector = require('./lib/select');
exports.matches = matches
exports.selectAll = selectAll
exports.select = select
var debug = require('debug')('unist-util-select');
var any = require('./lib/any')
var parse = require('./lib/parse')
function matches(selector, node) {
return Boolean(any(parse(selector), node, {one: true, shallow: true})[0])
}
var select = function select (ast, selector) {
if (arguments.length == 1) {
return select.bind(this, ast);
}
function select(selector, node) {
return any(parse(selector), node, {one: true})[0] || null
}
debug('Selector: %j', selector);
selector = parseSelector(selector);
debug('AST: %s',
JSON.stringify(selector, null, 2).replace(/(^|\n)/g, '\n '));
return selector ? matchSelector[selector.type](selector, ast) : [];
};
select.one = function selectOne (ast, selector) {
if (arguments.length == 1) {
return selectOne.bind(this, ast);
}
var nodes = select(ast, selector);
if (!nodes.length) {
throw Error('Node not found by ' + JSON.stringify(selector));
}
if (nodes.length > 1) {
throw Error('Node matched by ' + JSON.stringify(selector) + ' is not unique');
}
return nodes[0];
};
module.exports = select;
function selectAll(selector, node) {
return any(parse(selector), node, {})
}
{
"name": "unist-util-select",
"version": "1.5.0",
"version": "2.0.0",
"description": "Select unist nodes using css-like selectors",
"author": "Eugene Sharygin <eush77@gmail.com>",
"license": "MIT",
"scripts": {
"test": "tape test/*.js"
},
"files": [
"index.js",
"lib/"
],
"homepage": "https://github.com/eush77/unist-util-select",
"repository": "eush77/unist-util-select",
"bugs": {
"url": "https://github.com/eush77/unist-util-select/issues"
},
"keywords": [

@@ -42,11 +29,62 @@ "child",

],
"repository": "syntax-tree/unist-util-select",
"bugs": "https://github.com/syntax-tree/unist-util-select/issues",
"author": "Eugene Sharygin <eush77@gmail.com>",
"contributors": [
"Eugene Sharygin <eush77@gmail.com>",
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js",
"lib/"
],
"dependencies": {
"css-selector-parser": "^1.1.0",
"debug": "^2.2.0",
"nth-check": "^1.0.1"
"debug": "^3.1.0",
"not": "^0.1.0",
"nth-check": "^1.0.1",
"unist-util-is": "^2.1.2",
"zwitch": "^1.0.3"
},
"devDependencies": {
"nyc": "^13.1.0",
"prettier": "^1.15.1",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.2.0",
"unist-builder": "^1.0.1"
"unist-builder": "^1.0.3",
"xo": "^0.23.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test": "npm run format && npm run test-coverage"
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"max-params": "off"
}
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc