diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92ecc99..c572ccc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 2.0.8 (2018-06-14)
+
+* fix(gulp): don't verify commit for release ([08b77b3](https://github.com/lbenie/qselector/commit/08b77b3))
+* chore(fix gulp): fix gulp ([dd0f5cf](https://github.com/lbenie/qselector/commit/dd0f5cf))
+* docs(changelog): bumping version to 2.0.7 ([c2c325a](https://github.com/lbenie/qselector/commit/c2c325a))
+
+
+
## 2.0.7 (2018-06-13)
* fix(husky): fixes deploy command ([e8a2889](https://github.com/lbenie/qselector/commit/e8a2889))
diff --git a/lib/index.js b/lib/index.js
index b0b02f5..c989a20 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,45 +1,45 @@
import isDom from 'is-dom';
-
const errorSelector = 'Selector does not exists in the DOM';
const queryType = {
- single: true,
- multiple: false,
+ single: true,
+ multiple: false,
};
const isNanOrInfinite = (el, selector) => {
- const result = [
- Number.isNaN(el),
- Number.isNaN(selector),
- Number.isFinite(el),
- Number.isFinite(selector),
- ];
- return result.some(x => x);
+ const result = [
+ Number.isNaN(el),
+ Number.isNaN(selector),
+ Number.isFinite(el),
+ Number.isFinite(selector),
+ ];
+ return result.some(x => x);
};
const errorHanler = (isSingle, { el, selector }) => {
- const root = document.querySelector(el);
- const isNan = isNanOrInfinite(el, selector);
- if (isNan && isNan.toString().length !== 0) {
- throw new Error(errorSelector);
- } else if (isSingle) {
+ const root = document.querySelector(el);
+ const isNan = isNanOrInfinite(el, selector);
+ if (isNan && isNan.toString().length !== 0) {
+ throw new Error(errorSelector);
+ }
+ else if (isSingle) {
+ return selector ?
+ isDom(root.querySelector(selector)) :
+ isDom(root);
+ }
return selector ?
- isDom(root.querySelector(selector)) :
- isDom(root);
- }
- return selector ?
- isDom(...root.querySelectorAll(selector)) :
- isDom(...Array.from(document.querySelectorAll(el)));
+ isDom(...root.querySelectorAll(selector)) :
+ isDom(...Array.from(document.querySelectorAll(el)));
};
const core = (type, ...args) => {
- const isSingle = type === queryType.single;
- const [el, selector] = args;
- const root = document.querySelector(el);
- if (errorHanler(isSingle, { el, selector })) {
- if (selector) {
- return isSingle ? root.querySelector(selector) : [...root.querySelectorAll(selector)];
+ const isSingle = type === queryType.single;
+ const [el, selector] = args;
+ const root = document.querySelector(el);
+ if (errorHanler(isSingle, { el, selector })) {
+ if (selector) {
+ return isSingle ? root.querySelector(selector) : [...root.querySelectorAll(selector)];
+ }
+ return isSingle ? root : Array.from(document.querySelectorAll(el));
}
- return isSingle ? root : Array.from(document.querySelectorAll(el));
- }
- throw new Error(errorSelector);
+ throw new Error(errorSelector);
};
const $ = (el, selector) => core(queryType.single, el, selector);
const $$ = (el, selector) => core(queryType.multiple, el, selector);
-export { $, $$ };
+export { $, $$, };
diff --git a/package.json b/package.json
index d04f5a7..c4decf8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "qselector",
- "version": "2.0.7",
+ "version": "2.0.8",
"description": "Aliases for querySelector & querySelectorAll",
"keywords": [
"query",