Farmbot-Web-App/frontend/util/celery.ts

14 lines
368 B
TypeScript
Raw Normal View History

2018-05-01 18:30:04 -06:00
import { Dictionary } from "lodash";
import { Pair } from "farmbot/dist/corpus";
type PrimitiveMap = Dictionary<string | number | boolean | undefined>;
export function toPairs(input: PrimitiveMap): Pair[] {
return Object.keys(input).map(function (key): Pair {
return {
kind: "pair",
args: { label: key, value: input[key] || "null" }
};
});
}