本文整理汇总了TypeScript中farmbot.ParameterApplication类的典型用法代码示例。如果您正苦于以下问题:TypeScript ParameterApplication类的具体用法?TypeScript ParameterApplication怎么用?TypeScript ParameterApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParameterApplication类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: createParameterApplication
({ label, newVarLabel, allowedVariableNodes }: NewVariableProps):
VariableNode =>
(allowedVariableNodes === AllowedVariableNodes.identifier && newVarLabel)
// Create a new variable (reassignment)
? createParameterApplication(label,
{ kind: "identifier", args: { label: newVarLabel } })
: { // Unassign variable (will not create a new variable name)
kind: "parameter_declaration",
args: { label, default_value: NOTHING_SELECTED }
};
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:10,代码来源:handle_select.ts
示例2: describe
describe("mergeParameterApplications()", () => {
const bodyVariables: ParameterApplication[] = [
coordinateVar("parent1"),
coordinateVar("parent2"),
];
it("doesn't overwrite bodyVariables", () => {
const varData = fakeVariableNameSet("parent1");
const result = mergeParameterApplications(varData, bodyVariables);
expect(result).toEqual(bodyVariables);
});
it("adds new bodyVariables", () => {
// "parent2" will not be added: already exists
const varData = fakeVariableNameSet("parent2");
// "parent3" will not be added: already defined
const notAdded = "parent3";
varData[notAdded] = fakeVariableNameSet(notAdded)[notAdded];
// "parent4" will be added to the existing bodyVariables
const label = "parent4";
const add = fakeVariableNameSet(label)[label];
const addedNewDecl: ParameterDeclaration = {
kind: "parameter_declaration", args: {
label, default_value: COORDINATE
}
};
add && (add.celeryNode = addedNewDecl);
varData[label] = add;
const expected = cloneDeep(bodyVariables);
expected.push({
kind: "parameter_application", args: {
label, data_value: COORDINATE
}
});
const result = mergeParameterApplications(varData, bodyVariables);
expect(result).toEqual(expected);
});
});
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:41,代码来源:variable_support_test.ts
示例3: it
it("returns parameter applications", () => {
const result = variableList({
parent1: {
celeryNode: {
kind: "parameter_declaration", args: {
label: "parent1", default_value: COORDINATE
}
},
dropdown: { label: "Parent1", value: "parent1" },
vector: undefined,
},
parent2: {
celeryNode: coordinateVar("parent2"),
dropdown: { label: "Parent2", value: "parent2" },
vector: COORDINATE.args,
}
});
expect(result).toEqual([{
kind: "parameter_application",
args: { label: "parent1", data_value: COORDINATE }
}]);
});
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:22,代码来源:variable_support_test.ts
注:本文中的farmbot.ParameterApplication类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论