UNPKG

choo-shortcache

Version:

choo nanocomponent cache shortcut

15 lines (10 loc) 477 B
var stateCopy = require('state-copy') var pluck = require('plucker') module.exports = copy function copy (state) { var isStateString = state && typeof state === 'string' var isChooPath = isStateString && arguments.length === 1 && state.indexOf('state.') === 0 if (!state || typeof state === 'function') state = window.choo.state if (isChooPath) [].push.call(arguments, {state: window.choo.state}) stateCopy(isStateString ? pluck.apply(this, arguments) : state) }