import * as Vue from 'vue' ; import { Dictionary } from './declarations' ; export const noop = ( ) => { } ; export function warn ( message ) { console . error ( '[vue-canvas] ' + message ) ; } export function assert ( condition , message ) { if ( ! condition ) { throw new Error ( '[vue-canvas] ' + message ) ; } } export function contains < T > ( list , value ) { return list . indexOf ( value ) > - 1 ; } export function merge < T , U > ( t , u ) { const res = { } ; const list = [ t , u ] ; list . forEach ( obj => { Object . keys ( obj ) . forEach ( key => { res [ key ] = obj [ key ] ; } ) ; } ) ; return res ; } export function pick ( obj , keys ) { const res = { } ; keys . forEach ( key => { res [ key ] = obj [ key ] ; } ) ; return res ; } /**
 * Similar to Vue.nextTick but reduce duplicated functions
 */ export const throttledTick = ( function ( ) { const ticked = [ ] ; function resetTicked ( ) { ticked . length = 0 ; } return function ( fn ) : void { if ( contains ( ticked , fn ) ) return ; if ( ticked . length === 0 ) { Vue . nextTick ( resetTicked ) ; } ticked . push ( fn ) ; Vue . nextTick ( fn ) ; } ; } ( ) ) ;