當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。