bloody-attempt

0.0.0 • Public • Published

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"

Readme

Keywords

none

Package Sidebar

Install

npm i bloody-attempt

Weekly Downloads

1

Version

0.0.0

License

MIT

Last publish

Collaborators

  • bloodyowl