If We have
var randomname = {};
randomname.attribute = \'something\';
function randomname(){
alert(randomname.attribute);
}
randomname();
I know this is an old post, but I found an example of how it works.
In fact, I believe sequelize.js does it with the following code:
var STRING = function(length, binary) {
if (this instanceof STRING) {
this._binary = !!binary
if (typeof length === 'number') {
this._length = length
} else {
this._length = 255
}
} else {
return new STRING(length, binary)
}
}
STRING.prototype = {
get BINARY() {
this._binary = true
return this
},
get type() {
return this.toString()
},
toString: function() {
return 'VARCHAR(' + this._length + ')' + ((this._binary) ? ' BINARY' : '')
}
}
Object.defineProperty(STRING, 'BINARY', {
get: function() {
return new STRING(undefined, true)
}
})
You can see it in their docs for data types: http://sequelizejs.com/docs/latest/models#block-2-line-0. Notice Sequelize.STRING and Sequelize.STRING(1234)