Skip to content

Instantly share code, notes, and snippets.

@Ookami-san
Created July 12, 2019 15:44
Show Gist options
  • Save Ookami-san/0093cc5b70dcf351c315f380196c6dc4 to your computer and use it in GitHub Desktop.
Save Ookami-san/0093cc5b70dcf351c315f380196c6dc4 to your computer and use it in GitHub Desktop.
// https://github.com/juliangarnier/anime/blob/master/src/index.js
const is = {
arr: a => Array.isArray(a),
obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),
pth: a => is.obj(a) && a.hasOwnProperty('totalLength'),
svg: a => a instanceof SVGElement,
inp: a => a instanceof HTMLInputElement,
dom: a => a.nodeType || is.svg(a),
str: a => typeof a === 'string',
fnc: a => typeof a === 'function',
und: a => typeof a === 'undefined',
hex: a => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a),
rgb: a => /^rgb/.test(a),
hsl: a => /^hsl/.test(a),
col: a => (is.hex(a) || is.rgb(a) || is.hsl(a)),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment