Closed danielo515 closed 5 years ago
Are you suggesting something like the following?
// checkTypes :: Boolean
const checkTypes =
typeof process === 'undefined'
|| process == null
|| process.env == null
|| process.env.NODE_ENV !== 'production';
$.def = $.create ({checkTypes, env: $.env});
Hello @davidchambers,
I was not suggesting anything, I was just asking about the default behavior to avoid unnecessary code like I did for sanctuary.
However, I think it may be better to target node and allow bundles decide of process should exist? Apart from that, your suggestion looks fine
This would be useful for people using def
exclusively with built-in types; those defining their own types might still need to define their own def
with a custom environment.
This proposal would undoubtedly provide a convenience in some cases. I'm just not sure it warrants an increase in the surface area of the library's API.
Hello,
I just noticed that
def
is not part of sanctuary-def imports, you need to create it with your own env and with your desire of type-checking. Since sanctuary, by default, performs type checking on every scenario except production, I was wondering if this is extensible to sanctuary-def too.Regards