1 line
40 KiB
JSON
1 line
40 KiB
JSON
|
{"id":"node_modules/chai/lib/chai/utils/overwriteProperty.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/package.json","includedInParent":true,"mtime":1542067438335},{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/package.json","includedInParent":true,"mtime":1542058764034},{"name":"../../chai","loc":{"line":7,"column":19},"parent":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/overwriteProperty.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai.js"},{"name":"./flag","loc":{"line":8,"column":19},"parent":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/overwriteProperty.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/flag.js"},{"name":"./isProxyEnabled","loc":{"line":9,"column":29},"parent":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/overwriteProperty.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/isProxyEnabled.js"},{"name":"./transferFlags","loc":{"line":10,"column":28},"parent":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/overwriteProperty.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai/lib/chai/utils/transferFlags.js"}],"generated":{"js":"/*!\n * Chai - overwriteProperty utility\n * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>\n * MIT Licensed\n */\nvar chai = require('../../chai');\n\nvar flag = require('./flag');\n\nvar isProxyEnabled = require('./isProxyEnabled');\n\nvar transferFlags = require('./transferFlags');\n/**\n * ### .overwriteProperty(ctx, name, fn)\n *\n * Overwrites an already existing property getter and provides\n * access to previous value. Must return function to use as getter.\n *\n * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {\n * return function () {\n * var obj = utils.flag(this, 'object');\n * if (obj instanceof Foo) {\n * new chai.Assertion(obj.name).to.equal('bar');\n * } else {\n * _super.call(this);\n * }\n * }\n * });\n *\n *\n * Can also be accessed directly from `chai.Assertion`.\n *\n * chai.Assertion.overwriteProperty('foo', fn);\n *\n * Then can be used as any other assertion.\n *\n * expect(myFoo).to.be.ok;\n *\n * @param {Object} ctx object whose property is to be overwritten\n * @param {String} name of property to overwrite\n * @param {Function} getter function that returns a getter function to be used for name\n * @namespace Utils\n * @name overwriteProperty\n * @api public\n */\n\n\nmodule.exports = function overwriteProperty(ctx, name, getter) {\n var _get = Object.getOwnPropertyDescriptor(ctx, name),\n _super = function () {};\n\n if (_get && 'function' === typeof _get.get) _super = _get.get;\n Object.defineProperty(ctx, name, {\n get: function overwritingPropertyGetter() {\n // Setting the `ssfi` flag to `overwritingPropertyGetter` causes this\n // function to be the starting point for removing implementation frames\n // from the stack trace of a failed assertion.\n //\n // However, we only want to use this function as the starting point if\n // the `lockSsfi` flag isn't set and proxy protection is disabled.\n //\n // If the `lockSsfi` flag is set, then either this assertion has been\n // overwritten by another assertion, or this assertion is being invoked\n // from inside of another assertion. In the first case, the `ssfi` flag\n // has already been set by the overwriting assertion. In the second\n // case, the `ssfi` flag has already been set by the outer assertion.\n //\n // If proxy protection is enabled
|