{
  "name": "shimmer",
  "version": "1.0.0",
  "description": "Safe(r) monkeypatching for JavaScript.",
  "main": "index.js",
  "scripts": {
    "test": "tap test/*.tap.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/othiym23/shimmer.git"
  },
  "keywords": [
    "monkeypatch",
    "swizzle",
    "wrapping",
    "danger",
    "hmm",
    "shim"
  ],
  "author": {
    "name": "Forrest L Norvell",
    "email": "ogd@aoaioxxysz.net"
  },
  "license": "BSD",
  "devDependencies": {
    "tap": "~0.4.3",
    "sinon": "~1.7.2"
  },
  "readme": "## Safer monkeypatching for Node.js\n\n`shimmer` does a bunch of the work necessary to wrap other methods in\na wrapper you provide:\n\n```javascript\nvar http = require('http');\nvar shimmer = require('shimmer');\n\nshimmer.wrap(http, 'request', function (original) {\n  return function () {\n    console.log(\"Starting request!\");\n    var returned = original.apply(this, arguments)\n    console.log(\"Done setting up request -- OH YEAH!\");\n    return returned;\n  };\n});\n```\n\n### Mandatory disclaimer\n\nThere are times when it's necessary to monkeypatch default behavior in\nJavaScript and Node. However, changing the behavior of the runtime on the fly\nis rarely a good idea, and you should be using this module because you need to,\nnot because it seems like fun.\n\n### API\n\nAll monkeypatched functions have an attribute, `__wrapped`, set to true on\nthem.\n\n#### shimmer(options)\n\nIf you pass in an options object containing a function labeled `logger`,\n`shimmer` will use it instead of the logger, which defaults to `console.error`.\n`shimmer` is built to be as unobtrusive as possible and has no need to run\nasynchronously, so it defaults to logging when things fail, instead of\nthrowing.\n\n#### shimmer.wrap(nodule, name, wrapper)\n\n`shimmer` monkeypatches in place, so it expects to be passed an object.\nIt accepts either instances, prototypes, or the results of calling\n`require`. `name` must be the string key for the field's name on the\nobject.\n\n`wrapper` is a function that takes a single parameter, which is the original\nfunction to be monkeypatched. `shimmer` assumes that you're adding behavior\nto the original method, and not replacing it outright. If you *are* replacing\nthe original function, feel free to ignore the passed-in function.\n\nIf you *aren't* discarding the original, remember these tips:\n\n* call the original with something like `original.apply(this, arguments)`,\n  unless your reason for monkeypatching is to transform the arguments.\n* always capture and return the return value coming from the original function.\n  Today's null-returning callback is tomorrow's error-code returning callback.\n* Don't make an asynchronous function synchronous and vice versa.\n\n#### shimmer.massWrap(nodules, names, wrapper)\n\nJust like `wrap`, with the addition that you can wrap multiple methods on\nmultiple modules. Note that this function expects the list of functions to be\nmonkeypatched on all of the modules to be the same.\n\n#### shimmer.unwrap(nodule, name)\n\nA convenience function for restoring the function back the way it was before\nyou started. Won't unwrap if somebody else has monkeypatched the function after\nyou (but will log in that case). Won't throw if you try to double-unwrap a\nfunction (but will log).\n\n#### shimmer.wrapEmitter(emitter, mark, prepare)\n\nWrap an EventEmitter's event listeners. Each listener will be passed to\n`mark` when it is registered with `.addListener()` or `.on()`, and then\neach listener is passed to `prepare` to be wrapped before it's called\nby the `.emit()` call. `wrapListener` deals with the single listener\nvs array of listeners logic, and also ensures that edge cases like\n`.removeListener()` being called from within an `.emit()` for the same\nevent type is handled properly.\n\nThe wrapped EE can be restored to its pristine state by using\nemitter.__unwrap(), but this should only be used if you *really* know\nwhat you're doing.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/othiym23/shimmer/issues"
  },
  "homepage": "https://github.com/othiym23/shimmer",
  "_id": "shimmer@1.0.0",
  "_shasum": "49c2d71c678360b802be18b278382d1cbb805c39",
  "_from": "shimmer@1.0.0",
  "_resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.0.0.tgz"
}
