| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/chai-fs/lib/ |
Upload File : |
module.exports = function (chai, utils) {
/* jshint -W030 */
var Assertion = chai.Assertion;
var flag = utils.flag;
//-------------------------------------------------------------------------------------------------------------
// easy-overwrite chained prop depedning on earlier check
// example; expect(v).to.be.a.directory().and.not.empty
Assertion._overwritePropFlags = {};
Assertion.addOverwritePropertyFlag = function addOverwritePropertyFlag(prop, flag, func) {
if (!Assertion._overwritePropFlags.hasOwnProperty(prop)) {
Assertion._overwritePropFlags[prop] = [];
}
Assertion._overwritePropFlags[prop].push({prop: prop, flag: flag, func: func});
};
//TODO weird static/instance hybrid.. refactor too get rid of this
Assertion.handleOverwritePropertyFlag = function handleOverwritePropertyFlag(prop, obj) {
if (Assertion._overwritePropFlags.hasOwnProperty(prop)) {
var arr = Assertion._overwritePropFlags[prop];
for (var i = 0, ii = arr.length; i < ii; i++) {
var data = arr[i];
if (flag(this, data.flag) === true) {
data.func.call(this, obj);
return true;
}
}
}
return false;
};
//-------------------------------------------------------------------------------------------------------------
};