0.0.0 • Published 11 years ago
bloody-attempt v0.0.0
attempt
install
$ npm install bloody-attemptrequire
var attempt = require("bloody-attempt")api
attempt(fn) > boolean
returns whether or not fn execution has been without error.
attempt.withValue(fn) > value
returns the result of fn() or the error it threw.
attempt.all(object) > key || null
tries to execute functions in object until one does not error. returns the key matching the error free function. if none executed properly, null is returned.
attempt.all({
EVENT_OBJECT: function(){
document.createEventObject()
},
CUSTOM_EVENT: function(){
new CustomEvent(
"attempt",
{
bubbles: false,
cancelable: false
}, {
detail: {}
}
)
}
})
// => "CUSTOM_EVENT"0.0.0
11 years ago
