lib/base/attributes.js
function(name, fn) {
    const _name = this.store.toInternalAttributeName(name)
    const Store = require('../store')
    if (!this.attributes[_name]) throw new Store.UnknownAttributeError(name)

    this.attributes[_name].variant = fn

    this[name + '$'] = function(args) {
      return fn.call(this, this[_name], args)
    }

    return this
  }
function(name, fn) {
    const _name = this.store.toInternalAttributeName(name)
    const Store = require('../store')
    if (!this.attributes[_name]) throw new Store.UnknownAttributeError(name)

    this.attributes[_name].variant = fn

    this[name + '$'] = function(args) {
      return fn.call(this, this[_name], args)
    }

    return this
  }
function ( name , fn ) { const _name = this . store . toInternalAttributeName ( name ) const Store = require ( '../store' ) if ( ! this . attributes [ _name ] ) throw new Store . UnknownAttributeError ( name ) this . attributes [ _name ] . variant = fn this [ name + '$' ] = function ( args ) { return fn . call ( this , this [ _name ] , args ) } return this }
Add a variant method to the specified attribute

@class Definition
@method variant
@param {string} name - The attribute name
@param {function} fn - The method to call

@return {Definition}
Add a variant method to the specified attribute