本文整理汇总了TypeScript中@hpcc-js/util.exists函数的典型用法代码示例。如果您正苦于以下问题:TypeScript exists函数的具体用法?TypeScript exists怎么用?TypeScript exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exists函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("deepMixin", function () {
expect(exists("a", { a: "a" })).to.be.true;
expect(exists("b", { a: "a" })).to.be.false;
expect(exists("a.b", { a: { b: "b" } })).to.be.true;
expect(exists("a.b.c.d", { a: { b: { c: { d: "d" } } } })).to.be.true;
expect(exists("a.b.c.e", { a: { b: { c: { d: "d" } } } })).to.be.false;
expect(exists("e.b.c.d", { a: { b: { c: { d: "d" } } } })).to.be.false;
expect(exists("", { a: { b: { c: { d: "d" } } } })).to.be.false;
expect(exists("a", undefined)).to.be.false;
expect(exists(undefined as any, {})).to.be.false;
expect(exists("a", "a")).to.be.false;
expect(() => exists("a", null)).to.throw(Error);
});
示例2: parseXSD
return this.WUResult(from, count, !includeSchema, filter).then((response) => {
const result = response.Result;
delete response.Result; // Do not want it in "set"
this.set({
...response
} as any);
if (exists("XmlSchema.xml", result)) {
this.xsdSchema = parseXSD(result.XmlSchema.xml);
}
if (exists("Row", result)) {
return result.Row;
} else if (this.ResultName && exists(this.ResultName, result)) {
return result[this.ResultName].Row;
}
return [];
});
示例3:
return this.connection.TpServiceQuery({}).then(response => {
const rootProtocol = this.connection.protocol();
const ip = this.connection.ip();
let port = rootProtocol === "https:" ? "18002" : "8002";
if (exists("ServiceList.TpEspServers.TpEspServer", response)) {
for (const item of response.ServiceList.TpEspServers.TpEspServer) {
if (exists("TpBindings.TpBinding", item)) {
for (const binding of item.TpBindings.TpBinding) {
if (binding.Service === type && binding.Protocol + ":" === rootProtocol) {
port = binding.Port;
}
}
}
}
}
return `${rootProtocol}//${ip}:${port}/`;
});
示例4: exists
}).then(response => {
return exists("TargetClusterUsages.TargetClusterUsage", response) ? response.TargetClusterUsages.TargetClusterUsage : [];
});
示例5: expect
expect(() => exists("a", null)).to.throw(Error);