0.0.0 • Published 10 years ago

bloody-attempt v0.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

attempt

browser support

Build Status

install

$ npm install bloody-attempt

require

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

10 years ago