Skip to content

Commit

Permalink
Add JSDoc to help IDE's to understand what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen committed Jun 29, 2017
1 parent a868c4d commit 938ea02
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
'use strict';

/**
* @param {string} selector
* @param {Element} [parent]
* @return {?Element}
*/
function select (selector, parent) {
return (parent || document).querySelector(selector);
}

/**
* @param {string} selector
* @param {Element} [parent]
* @return {boolean}
*/
select.exists = function (selector, parent) {
return Boolean(select(selector, parent));
};

/**
* @param {string} selector
* @param {Element|Element[]} [parent]
* @return {Element[]}
*/
select.all = function (selector, parent) {
// select.all('selector') or select.all('selector', singleElementOrDocument)
if (!parent || typeof parent.querySelectorAll === 'function') {
Expand Down

0 comments on commit 938ea02

Please sign in to comment.