wallet-core/node_modules/empower-core/lib/default-options.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-05-28 00:38:50 +02:00
'use strict';
module.exports = function defaultOptions () {
return {
destructive: false,
bindReceiver: true,
onError: onError,
onSuccess: onSuccess,
patterns: [
'assert(value, [message])',
'assert.ok(value, [message])',
'assert.equal(actual, expected, [message])',
'assert.notEqual(actual, expected, [message])',
'assert.strictEqual(actual, expected, [message])',
'assert.notStrictEqual(actual, expected, [message])',
'assert.deepEqual(actual, expected, [message])',
'assert.notDeepEqual(actual, expected, [message])',
'assert.deepStrictEqual(actual, expected, [message])',
'assert.notDeepStrictEqual(actual, expected, [message])'
],
wrapOnlyPatterns: []
};
};
function onError (errorEvent) {
var e = errorEvent.error;
2017-08-14 05:01:11 +02:00
if (errorEvent.powerAssertContext && /^AssertionError/.test(e.name)) {
2017-05-28 00:38:50 +02:00
e.powerAssertContext = errorEvent.powerAssertContext;
}
throw e;
}
function onSuccess(successEvent) {
return successEvent.returnValue;
}