本文整理汇总了TypeScript中is.string函数的典型用法代码示例。如果您正苦于以下问题:TypeScript string函数的具体用法?TypeScript string怎么用?TypeScript string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
keys.map((key, i) => {
total++;
if (Is.string(key)) {
messageMap[key] = messages[i];
} else {
messageMap[key.key] = messages[i];
}
});
开发者ID:DMVillan,项目名称:vscode,代码行数:8,代码来源:i18n.ts
示例2: function
(BigQuery as any).getType_ = function(value) {
let typeName;
if (value instanceof (BigQuery as any).date) {
typeName = 'DATE';
} else if (value instanceof (BigQuery as any).datetime) {
typeName = 'DATETIME';
} else if (value instanceof (BigQuery as any).time) {
typeName = 'TIME';
} else if (value instanceof (BigQuery as any).timestamp) {
typeName = 'TIMESTAMP';
} else if (value instanceof Buffer) {
typeName = 'BYTES';
} else if (value instanceof Big) {
typeName = 'NUMERIC';
} else if (is.array(value)) {
return {
type: 'ARRAY',
arrayType: (BigQuery as any).getType_(value[0]),
};
} else if (is.bool(value)) {
typeName = 'BOOL';
} else if (is.number(value)) {
typeName = value % 1 === 0 ? 'INT64' : 'FLOAT64';
} else if (is.object(value)) {
return {
type: 'STRUCT',
structTypes: Object.keys(value).map(function(prop) {
return {
name: prop,
type: (BigQuery as any).getType_(value[prop]),
};
}),
};
} else if (is.string(value)) {
typeName = 'STRING';
}
if (!typeName) {
throw new Error(
[
'This value could not be translated to a BigQuery data type.',
value,
].join('\n')
);
}
return {
type: typeName,
};
};
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:51,代码来源:index.ts
示例3: query
/**
* Run a query scoped to your dataset.
*
* See {@link BigQuery#query} for full documentation of this method.
*
* @param {object} options See {@link BigQuery#query} for full documentation of this method.
* @param {function} [callback] See {@link BigQuery#query} for full documentation of this method.
* @returns {Promise} See {@link BigQuery#query} for full documentation of this method.
*/
query(options, callback) {
if (is.string(options)) {
options = {
query: options,
};
}
options = extend(true, {}, options, {
defaultDataset: {
datasetId: this.id,
},
location: this.location,
});
return this.bigQuery.query(options, callback);
};
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:25,代码来源:dataset.ts
示例4: createQueryStream
/**
* Run a query scoped to your dataset as a readable object stream.
*
* See {@link BigQuery#createQueryStream} for full documentation of this
* method.
*
* @param {object} options See {@link BigQuery#createQueryStream} for full
* documentation of this method.
* @returns {stream}
*/
createQueryStream(options) {
if (is.string(options)) {
options = {
query: options,
};
}
options = extend(true, {}, options, {
defaultDataset: {
datasetId: this.id,
},
location: this.location,
});
return this.bigQuery.createQueryStream(options);
};
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:26,代码来源:dataset.ts
示例5: is
export function is(value: any): value is LocalizeInfo {
let candidate = value as LocalizeInfo;
return Is.defined(candidate) && Is.string(candidate.key) && (Is.undef(candidate.comment) || (Is.array(candidate.comment) && candidate.comment.every(element => Is.string(element))));
}
开发者ID:DMVillan,项目名称:vscode,代码行数:4,代码来源:i18n.ts
注:本文中的is.string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论