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


TypeScript json.verifyObjectProperty函数代码示例

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


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

示例1: parseStackInfo

function parseStackInfo(obj: any): StackInfo|undefined {
  verifyObject(obj);

  let state = verifyObjectProperty(obj, 'state', verifyString);

  let channels: string[] = [];
  let lowerVoxelBound: vec3 = vec3.create();
  let upperVoxelBound: vec3 = vec3.create();

  if (VALID_STACK_STATES.has(state)) {
    let stackStatsObj = verifyObjectProperty(obj, 'stats', verifyObject);

    lowerVoxelBound = parseLowerVoxelBounds(stackStatsObj);
    upperVoxelBound = parseUpperVoxelBounds(stackStatsObj);

    if (stackStatsObj.hasOwnProperty('channelNames')) {
      channels = parseChannelNames(stackStatsObj);
    }
  } else if (PARTIAL_STACK_STATES.has(state)) {
    // Stacks in LOADING state will not have a 'stats' object.
    // Values will be populated from command arguments in MultiscaleVolumeChunkSource()
  } else {
    return undefined;
  }

  let voxelResolution: vec3 = verifyObjectProperty(obj, 'currentVersion', parseStackVersionInfo);

  let project: string = verifyObjectProperty(obj, 'stackId', parseStackProject);

  return {lowerVoxelBound, upperVoxelBound, voxelResolution, project, channels};
}
开发者ID:google,项目名称:neuroglancer,代码行数:31,代码来源:frontend.ts

示例2: parseTokenInfo

function parseTokenInfo(obj: any): TokenInfo {
  verifyObject(obj);
  return {
    channels: verifyObjectProperty(obj, 'channels', x => verifyObjectAsMap(x, parseChannelInfo)),
    scales: verifyObjectProperty(obj, 'dataset', parseScales),
  };
}
开发者ID:funkey,项目名称:neuroglancer,代码行数:7,代码来源:frontend.ts

示例3: parseVertexAttributeInfo

function parseVertexAttributeInfo(x: any): VertexAttributeInfo {
  verifyObject(x);
  return {
    dataType: verifyObjectProperty(x, 'dataType', y => verifyEnumString(y, DataType)),
    numComponents: verifyObjectProperty(x, 'numComponents', verifyPositiveInt),
  };
}
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:7,代码来源:frontend.ts

示例4: parseOwnerInfo

function parseOwnerInfo(obj: any): OwnerInfo {
  let stackObjs = parseArray(obj, verifyObject);

  if (stackObjs.length < 1) {
    throw new Error(`No stacks found for owner object.`);
  }

  let projects = new Map<string, ProjectInfo>();
  // Get the owner from the first stack
  let owner = verifyObjectProperty(stackObjs[0], 'stackId', parseStackOwner);

  for (let stackObj of stackObjs) {
    let stackName = verifyObjectProperty(stackObj, 'stackId', parseStackName);
    let stackInfo = parseStackInfo(stackObj);

    if (stackInfo !== undefined) {
      let projectName = stackInfo.project;
      let projectInfo = projects.get(projectName);

      if (projectInfo === undefined) {
        let stacks = new Map<string, StackInfo>();
        projects.set(projectName, {stacks});
        projectInfo = projects.get(projectName);
      }

      projectInfo!.stacks.set(stackName, stackInfo);
    }
  }

  return {owner, projects};
}
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:31,代码来源:frontend.ts

示例5: constructor

 constructor(public baseUrls: string[], public path: string, private obj: any) {
   verifyObject(obj);
   this.dataType = verifyObjectProperty(obj, 'data_type', x => verifyEnumString(x, DataType));
   this.numChannels = verifyObjectProperty(obj, 'num_channels', verifyPositiveInt);
   this.volumeType = verifyObjectProperty(obj, 'type', x => verifyEnumString(x, VolumeType));
   this.mesh = verifyObjectProperty(obj, 'mesh', verifyOptionalString);
   this.scales = verifyObjectProperty(obj, 'scales', x => parseArray(x, y => new ScaleInfo(y)));
 }
开发者ID:funkey,项目名称:neuroglancer,代码行数:8,代码来源:frontend.ts

示例6: parseChannelInfo

function parseChannelInfo(obj: any): ChannelInfo {
  verifyObject(obj);
  let channelType = verifyObjectProperty(obj, 'channel_type', verifyString);
  return {
    channelType,
    description: verifyObjectProperty(obj, 'description', verifyString),
    volumeType: getVolumeTypeFromChannelType(channelType),
    dataType: verifyObjectProperty(obj, 'datatype', x => verifyEnumString(x, DataType)),
  };
}
开发者ID:funkey,项目名称:neuroglancer,代码行数:10,代码来源:frontend.ts

示例7: constructor

 constructor(obj: any) {
   verifyObject(obj);
   this.dataType = verifyObjectProperty(obj, 'dataType', x => verifyEnumString(x, DataType));
   this.size = verifyObjectProperty(
       obj, 'dimensions', x => parseFixedLengthArray(vec3.create(), x, verifyPositiveInt));
   this.chunkSize = verifyObjectProperty(
       obj, 'blockSize', x => parseFixedLengthArray(vec3.create(), x, verifyPositiveInt));
   this.encoding =
       verifyObjectProperty(obj, 'compressionType', x => verifyEnumString(x, VolumeChunkEncoding));
 }
开发者ID:google,项目名称:neuroglancer,代码行数:10,代码来源:frontend.ts

示例8: parseScaleInfo

function parseScaleInfo(obj: any): ScaleInfo {
  verifyObject(obj);
  return {
    key: verifyObjectProperty(obj, 'key', verifyString),
    offset: verifyObjectProperty(obj, 'offset', verify3dVec),
    sizeInVoxels: verifyObjectProperty(obj, 'sizeInVoxels', verify3dDimensions),
    voxelSize: verifyObjectProperty(obj, 'voxelSize', verify3dScale),
    chunkDataSize: verifyObjectProperty(
        obj, 'chunkDataSize', x => x === undefined ? undefined : verify3dDimensions(x)),
  };
}
开发者ID:funkey,项目名称:neuroglancer,代码行数:11,代码来源:frontend.ts

示例9: parseLowerVoxelBounds

function parseLowerVoxelBounds(stackStatsObj: any): vec3 {
  verifyObject(stackStatsObj);
  let stackBounds = verifyObjectProperty(stackStatsObj, 'stackBounds', verifyObject);

  let lowerVoxelBound: vec3 = vec3.create();

  lowerVoxelBound[0] = verifyObjectProperty(stackBounds, 'minX', verifyInt);
  lowerVoxelBound[1] = verifyObjectProperty(stackBounds, 'minY', verifyInt);
  lowerVoxelBound[2] = verifyObjectProperty(stackBounds, 'minZ', verifyInt);

  return lowerVoxelBound;
}
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:12,代码来源:frontend.ts

示例10: parseUpperVoxelBounds

function parseUpperVoxelBounds(stackStatsObj: any): vec3 {
  verifyObject(stackStatsObj);
  let stackBounds = verifyObjectProperty(stackStatsObj, 'stackBounds', verifyObject);

  let upperVoxelBound: vec3 = vec3.create();

  upperVoxelBound[0] = verifyObjectProperty(stackBounds, 'maxX', verifyFloat)+1;
  upperVoxelBound[1] = verifyObjectProperty(stackBounds, 'maxY', verifyFloat)+1;
  upperVoxelBound[2] = verifyObjectProperty(stackBounds, 'maxZ', verifyFloat)+1;

  return upperVoxelBound;
}
开发者ID:google,项目名称:neuroglancer,代码行数:12,代码来源:frontend.ts


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