本文整理匯總了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;
}
}
});