Card = require './card' $ = require('jquery') $.card = {} $.card.fn = {} $.fn.card = (opts) -> $.card.fn.construct.apply(this, opts) $.fn.extend card: (option, args...) -> @each -> $this = $(this) data = $this.data('card') if !data $.each option, (key, value) => if value instanceof jQuery option[key] = value[0] option['form'] = this $this.data 'card', (data = new Card(option)) if typeof option == 'string' data[option].apply(data, args)