aboutsummaryrefslogtreecommitdiff
path: root/node_modules/babel-plugin-espower/lib/power-assert-recorder.js
blob: 0e59999f55dee265f2f8c13f117dfc35e5f13aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
module.exports = /* intentional newline */
  function () {
  function PowerAssertRecorder() {
    this.captured = [];
  }

  PowerAssertRecorder.prototype._capt = function _capt (value, espath) {
    this.captured.push({value: value, espath: espath});
    return value;
  };

  PowerAssertRecorder.prototype._expr = function _expr (value, source) {
    var capturedValues = this.captured;
    this.captured = [];
    return {
      powerAssertContext: {
        value: value,
        events: capturedValues
      },
      source: source
    };
  };

  return PowerAssertRecorder;
}