@medv/finder
Advanced tools
Comparing version 1.0.5 to 1.1.0
export declare type Options = { | ||
root: Element; | ||
idName: (name: string) => boolean; | ||
className: (name: string) => boolean; | ||
@@ -4,0 +5,0 @@ tagName: (name: string) => boolean; |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -17,4 +20,4 @@ var __generator = (this && this.__generator) || function (thisArg, body) { | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
@@ -67,2 +70,3 @@ case 0: case 1: t = op; break; | ||
root: document.body, | ||
idName: function (name) { return true; }, | ||
className: function (name) { return true; }, | ||
@@ -188,3 +192,3 @@ tagName: function (name) { return true; }, | ||
var elementId = input.getAttribute('id'); | ||
if (elementId) { | ||
if (elementId && config.idName(elementId)) { | ||
return { | ||
@@ -266,4 +270,4 @@ name: '#' + cssesc(elementId, { isIdentifier: true }), | ||
function combinations(stack, path) { | ||
var _i, _a, node; | ||
if (path === void 0) { path = []; } | ||
var _i, _a, node; | ||
return __generator(this, function (_b) { | ||
@@ -270,0 +274,0 @@ switch (_b.label) { |
{ | ||
"name": "@medv/finder", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "CSS Selector Generator", | ||
@@ -34,4 +34,4 @@ "main": "dist/index.js", | ||
"browser-env": "^3.2.5", | ||
"release-it": "^7.0.2", | ||
"typescript": "^2.7.2" | ||
"release-it": "^7.5.0", | ||
"typescript": "^3.0.1" | ||
}, | ||
@@ -44,4 +44,4 @@ "ava": { | ||
"dependencies": { | ||
"cssesc": "^1.0.0" | ||
"cssesc": "^2.0.0" | ||
} | ||
} |
@@ -60,2 +60,12 @@ ![finder](https://user-images.githubusercontent.com/141232/36463709-381f8c36-16fe-11e8-8fdc-fcbdd4f2a36c.png) | ||
#### `idName: (name: string) => boolean` | ||
Check if this ID can be used. For example you can restrict using framework specific IDs: | ||
```js | ||
const selector = finder(event.target, { | ||
idName: name => !name.startsWith('ember') | ||
}) | ||
``` | ||
#### `className: (name: string) => boolean` | ||
@@ -62,0 +72,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
336
126
24662
+ Addedcssesc@2.0.0(transitive)
- Removedcssesc@1.0.1(transitive)
Updatedcssesc@^2.0.0