lib/model/compiler.js
function compileCoercionMap( attributes ) {
	if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) {
		throw new TypeError( "definition of attributes must be object" );
	}

	const coercions = {};

	const attributeNames = Object.keys( attributes );
	for ( let ai = 0, aLength = attributeNames.length; ai < aLength; ai++ ) {
		const attributeName = attributeNames[ai];
		const attribute = attributes[attributeName];

		( function( name, handler, definition ) {
			coercions[name] = value => handler.coerce( value, definition );
		} )( attributeName, Types.selectByName( attribute.type ), attribute );
	}

	return coercions;
}
function compileCoercionMap( attributes ) {
	if ( !attributes || typeof attributes !== "object" || Array.isArray( attributes ) ) {
		throw new TypeError( "definition of attributes must be object" );
	}

	const coercions = {};

	const attributeNames = Object.keys( attributes );
	for ( let ai = 0, aLength = attributeNames.length; ai < aLength; ai++ ) {
		const attributeName = attributeNames[ai];
		const attribute = attributes[attributeName];

		( function( name, handler, definition ) {
			coercions[name] = value => handler.coerce( value, definition );
		} )( attributeName, Types.selectByName( attribute.type ), attribute );
	}

	return coercions;
}
function compileCoercionMap ( attributes ) { if ( ! attributes || typeof attributes !== "object" || Array . isArray ( attributes ) ) { throw new TypeError ( "definition of attributes must be object" ) ; } const coercions = { } ; const attributeNames = Object . keys ( attributes ) ; for ( let ai = 0 , aLength = attributeNames . length ; ai < aLength ; ai ++ ) { const attributeName = attributeNames [ ai ] ; const attribute = attributes [ attributeName ] ; ( function ( name , handler , definition ) { coercions [ name ] = value => handler . coerce ( value , definition ) ; } ) ( attributeName , Types . selectByName ( attribute . type ) , attribute ) ; } return coercions ; }
Compiles coercion handlers per attribute of model.

@param {object<string,object>} attributes definition of essential attributes
@returns {object<string,function(*,object):*>} map of attributes' names into either attribute's coercion handler
Compiles coercion handlers per attribute of model .