当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript utils.isObject函数代码示例

本文整理汇总了TypeScript中@orbit/utils.isObject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isObject函数的具体用法?TypeScript isObject怎么用?TypeScript isObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isObject函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: equalRecordIdentities

export function equalRecordIdentities(
  record1: RecordIdentity,
  record2: RecordIdentity
): boolean {
  return (
    (isNone(record1) && isNone(record2)) ||
    (isObject(record1) &&
      isObject(record2) &&
      record1.type === record2.type &&
      record1.id === record2.id)
  );
}
开发者ID:orbitjs,项目名称:orbit.js,代码行数:12,代码来源:record.ts

示例2: buildTransform

export function buildTransform(transformOrOperations: TransformOrOperations, transformOptions?: object, transformId?: string, transformBuilder?: TransformBuilder): Transform {
  if (typeof transformOrOperations === 'function') {
    return buildTransform(transformOrOperations(transformBuilder), transformOptions, transformId);

  } else {
    let transform = transformOrOperations as Transform;
    let operations: Operation[];
    let options: object;

    if (isObject(transform) && transform.operations) {
      if (transform.id && !transformOptions && !transformId) {
        return transform;
      }
      operations = transform.operations;
      options = transformOptions || transform.options;
    } else {
      if (isArray(transformOrOperations)) {
        operations = transformOrOperations as Operation[];
      } else {
        operations = [transformOrOperations as Operation];
      }
      options = transformOptions;
    }

    let id: string = transformId || Orbit.uuid();

    return { operations, options, id };
  }
}
开发者ID:SmuliS,项目名称:orbit.js,代码行数:29,代码来源:transform.ts

示例3: buildQuery

export function buildQuery(
  queryOrExpression: QueryOrExpression,
  queryOptions?: object,
  queryId?: string,
  queryBuilder?: QueryBuilder
): Query {
  if (typeof queryOrExpression === 'function') {
    return buildQuery(queryOrExpression(queryBuilder), queryOptions, queryId);
  } else {
    let query = queryOrExpression as Query;
    let expression: QueryExpression;
    let options: object;

    if (isObject(query) && query.expression) {
      if (query.id && !queryOptions && !queryId) {
        return query;
      }
      expression = query.expression;
      options = queryOptions || query.options;
    } else {
      if (queryOrExpression instanceof QueryTerm) {
        expression = queryOrExpression.toQueryExpression();
      } else {
        expression = queryOrExpression as QueryExpression;
      }
      options = queryOptions;
    }

    let id: string = queryId || Orbit.uuid();

    return { expression, options, id };
  }
}
开发者ID:orbitjs,项目名称:orbit.js,代码行数:33,代码来源:query.ts

示例4: parseFilterSpecifier

function parseFilterSpecifier(filterSpecifier: FilterSpecifier): FilterSpecifier {
  if (isObject(filterSpecifier)) {
    let s = filterSpecifier as FilterSpecifier;
    s.kind = s.kind || 'attribute';
    s.op = s.op || 'equal';
    return s;
  }
}
开发者ID:SmuliS,项目名称:orbit.js,代码行数:8,代码来源:query-term.ts

示例5: parseSortSpecifier

function parseSortSpecifier(sortSpecifier: SortSpecifier | string): SortSpecifier {
  if (isObject(sortSpecifier)) {
    let s = sortSpecifier as SortSpecifier;
    s.kind = s.kind || 'attribute';
    s.order = s.order || 'ascending';
    return s;
  } else if (typeof sortSpecifier === 'string') {
    return parseSortSpecifierString(sortSpecifier);
  }
  throw new Error('Sort expression must be either an object or a string.');
}
开发者ID:SmuliS,项目名称:orbit.js,代码行数:11,代码来源:query-term.ts

示例6: sortParamToSpecifier

function sortParamToSpecifier(param: SortQBParam): SortSpecifier {
  if (isObject(param)) {
    if (param.hasOwnProperty('kind')) {
      return param as SortSpecifier;
    } else if (param.hasOwnProperty('attribute')) {
      return {
        kind: 'attribute',
        attribute: (param as AttributeSortQBParam).attribute,
        order: (param as AttributeSortQBParam).order || 'ascending'
      } as AttributeSortSpecifier;
    }
  } else if (typeof param === 'string') {
    return parseSortParamString(param);
  }
  throw new Error('Unrecognized sort param.');
}
开发者ID:orbitjs,项目名称:orbit.js,代码行数:16,代码来源:query-term.ts


注:本文中的@orbit/utils.isObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。