replace jest with ava
This commit is contained in:
parent
27cc8b23fe
commit
0347b72305
11775 changed files with 84546 additions and 1440575 deletions
42
node_modules/ava/lib/context-ref.js
generated
vendored
Normal file
42
node_modules/ava/lib/context-ref.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
const clone = require('lodash/clone');
|
||||
|
||||
class ContextRef {
|
||||
constructor() {
|
||||
this.value = {};
|
||||
}
|
||||
|
||||
get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
set(newValue) {
|
||||
this.value = newValue;
|
||||
}
|
||||
|
||||
copy() {
|
||||
return new LateBinding(this);
|
||||
}
|
||||
}
|
||||
module.exports = ContextRef;
|
||||
|
||||
class LateBinding extends ContextRef {
|
||||
constructor(ref) {
|
||||
super();
|
||||
this.ref = ref;
|
||||
this.bound = false;
|
||||
}
|
||||
|
||||
get() {
|
||||
if (!this.bound) {
|
||||
this.set(clone(this.ref.get()));
|
||||
}
|
||||
|
||||
return super.get();
|
||||
}
|
||||
|
||||
set(newValue) {
|
||||
this.bound = true;
|
||||
super.set(newValue);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue