Created
September 2, 2015 21:09
-
-
Save gordonbrander/16cfaf7c2d3246a29b84 to your computer and use it in GitHub Desktop.
yayquery.js - All you really need
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const $$ = (selector) => document.querySelector(selector); | |
export const $ = (selector) => document.querySelectorAll(selector); | |
// Apply a side effect to `n` items. | |
export const sets = (f, n, ...rest) => { | |
for (var i = 0; i < n.length; i++) f(n[i], ...rest); | |
} | |
export const toggleClass = (el, classname, isAdding) => | |
isAdding ? el.classList.add(classname) : el.classList.remove(classname); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment