Skip to content

Instantly share code, notes, and snippets.

@adalberth
Created November 7, 2018 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adalberth/85ea4598a3b277bccd53679f800d98a2 to your computer and use it in GitHub Desktop.
Save adalberth/85ea4598a3b277bccd53679f800d98a2 to your computer and use it in GitHub Desktop.
Utils functions - just nice to have around
/*
css(element, {
backgroundColor: 'red',
})
*/
export function css (el, styles) {
for (var style in styles) {
el.style[style] = styles[style]
}
}
/*
fl(n, i => {
// do something
})
*/
export function fl(length, callback) {
for (let i = 0; i < length; i++) {
callback(i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment