diff --git a/package.json b/package.json index d496d9c..8e8d280 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fluxduct", "type": "module", - "version": "0.4.0", + "version": "0.5.0", "description": "A low-level JSON-safe programming language", "main": "src/index.js", "module": "src/index.js", diff --git a/src/constants/conditional-functions.js b/src/constants/conditional-functions.js deleted file mode 100644 index 4d62c23..0000000 --- a/src/constants/conditional-functions.js +++ /dev/null @@ -1,3 +0,0 @@ -import evaluateIf from '../functions/if.js'; - -export default { if: (dictionary, args) => evaluateIf(dictionary, args) } diff --git a/src/constants/conditionals.js b/src/constants/conditionals.js deleted file mode 100644 index 88a1b1e..0000000 --- a/src/constants/conditionals.js +++ /dev/null @@ -1 +0,0 @@ -export default new Set(['if']); diff --git a/src/constants/operator-functions.js b/src/constants/operator-functions.js deleted file mode 100644 index 3536d6a..0000000 --- a/src/constants/operator-functions.js +++ /dev/null @@ -1,11 +0,0 @@ -import add from '../functions/add.js'; -import subtract from '../functions/subtract.js'; -import multiply from '../functions/multiply.js'; -import divide from '../functions/divide.js'; - -export default { - add: (dictionary, args) => add(dictionary, args), - subtract: (dictionary, args) => subtract(dictionary, args), - multiply: (dictionary, args) => multiply(dictionary, args), - divide: (dictionary, args) => divide(dictionary, args), -} diff --git a/src/functions/add.js b/src/functions/add.js deleted file mode 100644 index 4827ae3..0000000 --- a/src/functions/add.js +++ /dev/null @@ -1,3 +0,0 @@ -import evaluate from './evaluate.js'; - -export default (dictionary, [a, b]) => evaluate(dictionary, a) + evaluate(dictionary, b); diff --git a/src/functions/add.test.js b/src/functions/add.test.js deleted file mode 100644 index 08e2cd5..0000000 --- a/src/functions/add.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { strict as assert } from 'assert'; - -import add from './add.js'; - -export default { - 'can add two basic paths': () => assert.equal(add({ foo: 1, bar: 4 }, [{ path: ['foo'] }, { path: ['bar'] }]), 5) -} diff --git a/src/functions/divide.js b/src/functions/divide.js deleted file mode 100644 index ea9ff4d..0000000 --- a/src/functions/divide.js +++ /dev/null @@ -1,3 +0,0 @@ -import evaluate from './evaluate.js'; - -export default (dictionary, [a, b]) => evaluate(dictionary, a) / evaluate(dictionary, b); diff --git a/src/functions/divide.test.js b/src/functions/divide.test.js deleted file mode 100644 index e889573..0000000 --- a/src/functions/divide.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { strict as assert } from 'assert'; - -import divide from './divide.js'; - -export default { - 'can divide two basic paths': () => assert.equal(divide({ foo: 4, bar: 4 }, [{ path: ['foo'] }, { path: ['bar'] }]), 1) -} diff --git a/src/functions/if.js b/src/functions/if.js deleted file mode 100644 index ac89b42..0000000 --- a/src/functions/if.js +++ /dev/null @@ -1,7 +0,0 @@ -import evaluate from './evaluate.js'; - -export default (dictionary, [a, ...args]) => { - a = evaluate(dictionary, a, 'boolean'); - const [b, c] = args.map(arg => evaluate(dictionary, arg)); - return a ? b : c; -} \ No newline at end of file diff --git a/src/functions/if.test.js b/src/functions/if.test.js deleted file mode 100644 index 0af08e5..0000000 --- a/src/functions/if.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { strict as assert } from 'assert'; - -import evaluateIf from './if.js'; - -export default { - 'can evaluate a basic if': () => assert.equal(evaluateIf({ foo: 1, bar: 4, baz: true }, [{ path: ['baz'] }, { path: ['foo'] }, { path: ['bar'] }]), 1) -} diff --git a/src/functions/multiply.js b/src/functions/multiply.js deleted file mode 100644 index 91ddcd0..0000000 --- a/src/functions/multiply.js +++ /dev/null @@ -1,3 +0,0 @@ -import evaluate from './evaluate.js'; - -export default (dictionary, [a, b]) => evaluate(dictionary, a) * evaluate(dictionary, b); diff --git a/src/functions/multiply.test.js b/src/functions/multiply.test.js deleted file mode 100644 index 4d79dcf..0000000 --- a/src/functions/multiply.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { strict as assert } from 'assert'; - -import multiply from './multiply.js'; - -export default { - 'can multiply two basic paths': () => assert.equal(multiply({ foo: 1, bar: 4 }, [{ path: ['foo'] }, { path: ['bar'] }]), 4) -} diff --git a/src/functions/subtract.js b/src/functions/subtract.js deleted file mode 100644 index 6f42404..0000000 --- a/src/functions/subtract.js +++ /dev/null @@ -1,3 +0,0 @@ -import evaluate from './evaluate.js'; - -export default (dictionary, [a, b]) => evaluate(dictionary, a) - evaluate(dictionary, b); diff --git a/src/functions/subtract.test.js b/src/functions/subtract.test.js deleted file mode 100644 index e2bb003..0000000 --- a/src/functions/subtract.test.js +++ /dev/null @@ -1,7 +0,0 @@ -import { strict as assert } from 'assert'; - -import subtract from './subtract.js'; - -export default { - 'can subtract two basic paths': () => assert.equal(subtract({ foo: 1, bar: 4 }, [{ path: ['foo'] }, { path: ['bar'] }]), -3) -}