make 'names' accept only an array of strings, add warning comments about where new functions should be added

This commit is contained in:
Kevin Barabash
2017-08-26 19:15:40 -04:00
committed by Kevin Barabash
parent 6db61cb219
commit 12399da73d
7 changed files with 28 additions and 19 deletions

View File

@@ -3,9 +3,17 @@ import ParseError from "./ParseError";
import ParseNode from "./ParseNode";
import {default as _defineFunction, ordargument} from "./defineFunction";
// WARNING: New functions should be added to src/functions.
// Define a convenience function that mimcs the old semantics of defineFunction
// to support existing code so that we can migrate it a little bit at a time.
const defineFunction = function(names, props, handler) {
if (typeof names === "string") {
names = [names];
}
if (typeof props === "number") {
props = { numArgs: props };
}
_defineFunction({names, props, handler});
};