Skip to content

Commit

Permalink
docs(changelog): bumping version to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenie committed Jun 14, 2018
1 parent c5fda8c commit 09bfa2b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## 2.2.0 (2018-06-14)

* feat(typings): provides better intellisense ([c5fda8c](https://github.com/lbenie/qselector/commit/c5fda8c))



## 2.1.0 (2018-06-14)

* docs(changelog): bumping version to 2.1.0 ([4acabe8](https://github.com/lbenie/qselector/commit/4acabe8))
* fix(npm): fix resolving npm files ([6e9f705](https://github.com/lbenie/qselector/commit/6e9f705))


Expand Down
4 changes: 2 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare const $: (el: any, selector?: any) => HTMLElement | Error | HTMLElement[];
declare const $$: (el: any, selector?: any) => HTMLElement | Error | HTMLElement[];
declare const $: (el: string, selector?: string | undefined) => Element | Element[] | null;
declare const $$: (el: string, selector?: string | undefined) => Element | Element[] | null;
export { $, $$, };
//# sourceMappingURL=index.d.ts.map
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const isNanOrInfinite = (el, selector) => {
const errorHanler = (isSingle, { el, selector }) => {
const root = document.querySelector(el);
const isNan = isNanOrInfinite(el, selector);
if (!root) {
return false;
}
if (isNan && isNan.toString().length !== 0) {
throw new Error(errorSelector);
}
Expand All @@ -31,7 +34,10 @@ const errorHanler = (isSingle, { el, selector }) => {
const core = (type, ...args) => {
const isSingle = type === queryType.single;
const [el, selector] = args;
const root = document.querySelector(el);
const root = document.querySelector(el || '');
if (!root || !el) {
throw new Error(errorSelector);
}
if (errorHanler(isSingle, { el, selector })) {
if (selector) {
return isSingle ? root.querySelector(selector) : [...root.querySelectorAll(selector)];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qselector",
"version": "2.1.0",
"version": "2.2.0",
"description": "Aliases for querySelector & querySelectorAll",
"keywords": [
"query",
Expand Down

0 comments on commit 09bfa2b

Please sign in to comment.