本文整理汇总了TypeScript中core/util/types.isTypedArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isTypedArray函数的具体用法?TypeScript isTypedArray怎么用?TypeScript isTypedArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isTypedArray函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: map_data
map_data(): void {
const self = this as any
for (let [xname, yname] of this.model._coords) {
const sxname = `s${xname}`
const syname = `s${yname}`
xname = `_${xname}`
yname = `_${yname}`
if (self[xname] != null && (isArray(self[xname][0]) || isTypedArray(self[xname][0]))) {
const ni = self[xname].length
self[sxname] = new Array(ni)
self[syname] = new Array(ni)
for (let i = 0; i < ni; i++) {
const nj = self[xname][i].length
self[sxname][i] = new Array(nj)
self[syname][i] = new Array(nj)
for (let j = 0; j < nj; j++) {
const nk = self[xname][i][j].length
self[sxname][i][j] = new Array(nk)
self[syname][i][j] = new Array(nk)
for (let k = 0; k < nk; k++) {
const [sx, sy] = this.map_to_screen(self[xname][i][j][k], self[yname][i][j][k])
self[sxname][i][j][k] = sx
self[syname][i][j][k] = sy
}
}
}
}
}
}
开发者ID:digitalsatori,项目名称:Bokeh,代码行数:33,代码来源:multi_polygons.ts
示例2: stream_to_column
export function stream_to_column(col: Arrayable, new_col: Arrayable, rollover?: number): Arrayable {
if (isArray(col)) {
const result = col.concat(new_col)
if (rollover != null && result.length > rollover)
return result.slice(-rollover)
else
return result
} else if (isTypedArray(col)) {
const total_len = col.length + new_col.length
// handle rollover case for typed arrays
if (rollover != null && total_len > rollover) {
const start = total_len - rollover
const end = col.length
// resize col if it is shorter than the rollover length
let result: TypedArray
if (col.length < rollover) {
result = new ((col as any).constructor)(rollover)
result.set(col, 0)
} else
result = col
// shift values in original col to accommodate new_col
for (let i = start, endi = end; i < endi; i++) {
result[i-start] = result[i]
}
// update end values in col with new_col
for (let i = 0, endi = new_col.length; i < endi; i++) {
result[i+(end-start)] = new_col[i]
}
return result
} else {
const tmp = new ((col as any).constructor)(new_col)
return typed_array.concat(col, tmp)
}
} else
throw new Error("unsupported array types")
}
开发者ID:jsignell,项目名称:bokeh,代码行数:42,代码来源:column_data_source.ts
注:本文中的core/util/types.isTypedArray函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论