本文整理汇总了TypeScript中underscore.isArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isArray函数的具体用法?TypeScript isArray怎么用?TypeScript isArray使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isArray函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return _.filter(filters, function (f:Filter) {
f.multi = _.isArray(f.value);
// If multi-logic undefined - use Or
f.multiLogic = undefined === f.multiLogic ? FilterMultiLogic.Or : f.multiLogic;
return !(f.multi ? f.value.length === 0 : (f.value === '' || f.value === undefined));
});
示例2: convert
convert(content: string): string {
let jsonContent = JSON.parse(content);
if (_.isArray(jsonContent)) {
return this.convertObjectToTsInterfaces(jsonContent[0]);
}
return this.convertObjectToTsInterfaces(jsonContent);
}
示例3: convertJavaScriptToVariant
export function convertJavaScriptToVariant(
argumentDefinition: ArgumentOptions[],
values: any[]
): Variant[] {
assert(argumentDefinition.length === values.length);
assert(_.isArray(argumentDefinition));
assert(_.isArray(values));
return _.zip(values, argumentDefinition).map((pair: any) => {
pair = pair as [VariantLike, Argument];
const value = pair[0];
const arg = pair[1];
const variant = _.extend({}, arg);
variant.value = value;
return new Variant(variant);
});
}
示例4: coerceByteString
export function coerceByteString(value: any): ByteString {
if (_.isArray(value)) {
return Buffer.from(value);
}
if (typeof value === "string") {
return Buffer.from(value, "base64");
}
return value;
}
示例5: eachResult
export async function eachResult(result, cb) {
if (_.isArray(result)) {
for (let i in result) {
await cb(result[i], i);
}
} else {
await cb(result, 0);
}
}
示例6: serializeParameter
private static serializeParameter(val: any): string {
if (_.isObject(val) ||
_.isArray(val))
{
return JSON.stringify(val);
}
return val;
}
示例7: output
public output(section: GenericValueOutputType): ITableDataSource {
if (isArray(section)) {
return this.arrayJoined(section);
}
if (isObject(section)) {
return this.objectJoined(section as Record<string, any>);
}
return this.simpleValue(section as string | number | undefined);
}
示例8: normalizeConnections
private static normalizeConnections(data: any, id: number): Connection[] {
if(data && data.connections && _.isArray(data.connections)){
return _.each(data.connections, (raw: Connection) => {
var isIncoming = raw.requested_id === id;
raw._participant_id = isIncoming ? raw.registration_id : raw.requested_id;
return raw;
}) as Connection[];
} else {
return [];
}
}
示例9: normalizeParticipants
private static normalizeParticipants(data: any, searchField: string): Participant[] {
if(data && data.participant && _.isArray(data.participant)){
return _.each(data.participant, (raw:Participant) => {
var v = raw[searchField];
raw._search = typeof v == 'string' ? v.toLowerCase() : '';
return raw;
}) as Participant[];
} else {
return [];
}
}
示例10:
_.find(haystack, (childHaystack) => {
if (childHaystack.hasOwnProperty(needle) && childHaystack[needle] === value) {
ret = childHaystack;
return true;
}
if (_.isObject(childHaystack) || _.isArray(childHaystack)) {
ret = this.findDeep(childHaystack, needle, value);
if (ret != null) {
return true;
}
}
});