contractis
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -53,3 +53,10 @@ var stackTrace = require("stack-trace"); | ||
const contract_function = (fun, contr, that, check_vars, contrDefinition) => { | ||
const contract_function = ( | ||
fun, | ||
contr, | ||
that, | ||
check_vars, | ||
contrDefinition, | ||
fname | ||
) => { | ||
function newf(...args) { | ||
@@ -66,3 +73,3 @@ const opts = get_arguments_returns(contr); | ||
rv, | ||
"return value", | ||
"return value " + (fname || ""), | ||
contrDefinition, | ||
@@ -77,3 +84,3 @@ newf | ||
v, | ||
"promise value", | ||
"promise value " + (fname || ""), | ||
contrDefinition, | ||
@@ -97,2 +104,3 @@ newf | ||
const contract_class = that => { | ||
if (!enabled) return; | ||
const proto = Object.getPrototypeOf(that); | ||
@@ -121,6 +129,20 @@ const opts = proto.constructor.contract; | ||
const oldf = d.value; | ||
d.value = contract_function(oldf, v, that); | ||
d.value = contract_function( | ||
oldf, | ||
v, | ||
that, | ||
undefined, | ||
undefined, | ||
`${proto.constructor.name}.${k}` | ||
); | ||
} else if (d.get) { | ||
const oldf = d.get; | ||
d.get = contract_function(oldf, v, that); | ||
d.get = contract_function( | ||
oldf, | ||
v, | ||
that, | ||
undefined, | ||
undefined, | ||
`${proto.constructor.name}.${k}` | ||
); | ||
} | ||
@@ -142,6 +164,20 @@ | ||
const oldf = d.value; | ||
d.value = contract_function(oldf, v, that); | ||
d.value = contract_function( | ||
oldf, | ||
v, | ||
that, | ||
undefined, | ||
undefined, | ||
`${proto.constructor.name}.${k}` | ||
); | ||
} else if (d.get) { | ||
const oldf = d.get; | ||
d.get = contract_function(oldf, v, that); | ||
d.get = contract_function( | ||
oldf, | ||
v, | ||
that, | ||
undefined, | ||
undefined, | ||
`${proto.constructor.name}.${k}` | ||
); | ||
} | ||
@@ -148,0 +184,0 @@ d.writable = false; |
@@ -115,3 +115,3 @@ const gen = require("./generators"); | ||
typeof x === "object" && | ||
(typeof alsoCheckThat === "undefined" || alsoCheckThat(o)) && | ||
(typeof alsoCheckThat === "undefined" || alsoCheckThat(x)) && | ||
Object.entries(o || {}).every(([k, v]) => v.check(x[k])), | ||
@@ -118,0 +118,0 @@ generate: |
{ | ||
"name": "contractis", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -19,3 +19,4 @@ "main": "index.js", | ||
"testEnvironment": "node" | ||
} | ||
}, | ||
"gitHead": "2f1c8cbb28195cacaee48648f60817e17fa3601b" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31519
10
1100