Comparing version 1.0.6 to 1.1.0
@@ -0,1 +1,10 @@ | ||
<a name="1.1.0"></a> | ||
## 1.1.0 (2018-04-27) | ||
* add stryker badge to readme ([0a550df](https://github.com/lbenie/qselector/commit/0a550df)) | ||
* add stryker mutation testing ([422a31b](https://github.com/lbenie/qselector/commit/422a31b)) | ||
* add templates for contributions and pr/issues [skip-ci] ([edf08ed](https://github.com/lbenie/qselector/commit/edf08ed)) | ||
<a name="1.0.6"></a> | ||
@@ -2,0 +11,0 @@ ## <small>1.0.6 (2018-04-26)</small> |
@@ -5,17 +5,10 @@ import isDom from 'is-dom'; | ||
const queryType = { | ||
single: '$', | ||
multiple: '$$', | ||
single: true, | ||
multiple: false, | ||
}; | ||
const isNan = (el, selector) => { | ||
const isNanOrInfinite = (el, selector) => { | ||
const result = [ | ||
Number.isNaN(el), | ||
Number.isNaN(selector), | ||
]; | ||
return result.find(x => x === true); | ||
}; | ||
const isInfinity = (el, selector) => { | ||
const result = [ | ||
Number.isFinite(el), | ||
@@ -25,3 +18,3 @@ Number.isFinite(selector), | ||
return result.find(x => x === false); | ||
return result.find(x => x); | ||
}; | ||
@@ -31,4 +24,5 @@ | ||
const root = document.querySelector(el); | ||
const isNan = isNanOrInfinite(el, selector); | ||
if (isNan(el, selector) || isInfinity(el, selector)) { | ||
if (isNan && isNan.toString().length !== 0) { | ||
throw new Error(errorSelector); | ||
@@ -35,0 +29,0 @@ } else if (isSingle) { |
{ | ||
"name": "qselector", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "Aliases for querySelector & querySelectorAll", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"scripts": { | ||
"test": "jest --config jest.config.js --colors", | ||
"test": "jest --config jest.config.js --colors && stryker run", | ||
"test:dev": "cross-env BABEL_ENV=test jest --config jest.config.js --watch", | ||
@@ -55,3 +55,10 @@ "changelog": "conventional-changelog -i CHANGELOG.md -s", | ||
"jest": "^22.4.3", | ||
"lint-staged": "^7.0.5" | ||
"lint-staged": "^7.0.5", | ||
"stryker": "^0.22.4", | ||
"stryker-api": "^0.16.1", | ||
"stryker-babel-transpiler": "^0.4.2", | ||
"stryker-baseline-reporter": "^1.0.3", | ||
"stryker-html-reporter": "^0.13.3", | ||
"stryker-javascript-mutator": "^0.6.3", | ||
"stryker-jest-runner": "^0.6.0" | ||
}, | ||
@@ -58,0 +65,0 @@ "engines": { |
# qselector | ||
[![Build Status](https://travis-ci.org/lbenie/qselector.svg?branch=master)](https://travis-ci.org/lbenie/qselector) | ||
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/lbenie/qselector/master)](https://stryker-mutator.github.io) | ||
@@ -5,0 +6,0 @@ qselector (query selector) is just a small package to create aliases for `querySelector` and `querySelectorAll` to `$` and `$$` respectively. |
10291
91
22
47