From f73452e01fb96e010e6bbb140e514ab0f19cabe6 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Mon, 20 Aug 2018 01:05:46 +0100 Subject: [PATCH] making SyncDish composable! we want to exclude certain ops from top level api export (chef, etc) and make an Order (or something) class to start the chain off maybe? --- src/node/SyncDish.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/node/SyncDish.mjs b/src/node/SyncDish.mjs index eff39744..a3d87e14 100644 --- a/src/node/SyncDish.mjs +++ b/src/node/SyncDish.mjs @@ -9,6 +9,7 @@ import Utils from "../core/Utils"; import Dish from "../core/Dish"; import BigNumber from "bignumber.js"; import log from "loglevel"; +import * as ops from "./index"; /** * Subclass of Dish where `get` and `_translate` are synchronous. @@ -16,6 +17,16 @@ import log from "loglevel"; */ class SyncDish extends Dish { + /** */ + constructor(dish=null) { + super(dish); + + for (const op in ops) { + this[op] = () => ops[op](this.value); + } + + } + /** * Synchronously returns the value of the data in the type format specified. * @@ -164,4 +175,7 @@ class SyncDish extends Dish { } + + + export default SyncDish;