Skip to content

Commit dd836b5

Browse files
♻️ refactor(Two): Implement node method.
This will be used in a later commit.
1 parent ad47f74 commit dd836b5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/1-digit/2-Two.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'assert';
2-
import {node2, node3} from '../2-node/index.js';
2+
import {Node2, node2, node3} from '../2-node/index.js';
33
import {Split} from '../0-core/index.js';
44
import {Digit, One, Three} from './index.js';
55

@@ -40,10 +40,8 @@ Two.prototype.cons = function (value) {
4040
return new Three(value, this.a, this.b);
4141
};
4242

43-
Two.prototype.node = function (_M) {
44-
throw new Error(
45-
'Two should never be converted to Node2 with current implementation',
46-
);
43+
Two.prototype.node = function (M) {
44+
return new Node2(this.measure(M), this.a, this.b);
4745
};
4846

4947
/**

0 commit comments

Comments
 (0)