Validate options like a PRO!
const options =
{
port: 80,
frame:
{
compression:
{
treshold: 2048
}
},
client:
{
accept : () => true
}
};
this._options = Options( options,
{
server : { _required: false, _passes: $ => $ instanceof Server },
tls : { _required: false, _type: 'object' },
port : { _required: true, _convert: parseInt },
version : { _any: [ 8, 13 ] }
frame :
{
_expand : true,
mask : { _type: 'boolean', _default: false },
limit : { _type: 'number', _default: 100 * 1024 * 1024, _convert: $ => Math.min( $, 100 * 1024 * 1024 )},
compression :
{
_default: false, _expand: true,
treshold: { _type: 'number', _default: 1024 }
}
},
client :
{
_expand : true,
accept : { _type: 'function' }
}
});