本文整理汇总了TypeScript中lodash-es/isString.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: detachComponent
/**
* Detaches a component from this container and returns it.
*
* Once component is detached, a `detachComponent` event is fired with following arguments.
* 1. The newly created component
* 2. This container
* 3. Additional params passed in to this call
*
* @param pos The position from which component should be detached
* @param params additional params to be passed down the the `detachComponent` event
*/
public detachComponent(pos: number, params: any = {}): Component {
if (isString(pos)) {
const id = pos;
let i;
for (i = 0; i < this.components.length; i++) {
if (this.components[i].getId() === id) {
pos = i;
break;
}
}
if (i === this.components.length) {
return;
}
}
const component = this.components[pos];
this.components.splice(pos, 1);
params = defaults({pos}, params);
this.emit("detachComponent", component, this, params);
return component;
}
示例2: drop
const args = drop(entry).map(arg => {
if (isString(arg)) {
if (arg.substring(0, 5) === "__REG") {
return this.registerBank[arg];
} else {
return this[arg];
}
} else {
return arg;
}
});
示例3: findIndex
private findIndex(arg: string | number): number {
let index;
if (isString(arg) && arg in this.names) {
index = this.names[arg].index;
} else if (isNumber(arg) && arg >= 0 && arg < this.textures.length) {
index = arg;
} else {
// tslint:disable-next-line:no-console
console.log("arg = ", typeof(arg), "textures = ", this.textures);
throw new Error("Unknown texture '" + arg + "'");
}
return index;
}
示例4: removeTexture
/**
* Removes a texture
* @param nameOrIndex name or index of the texture to be removed
*/
public removeTexture(nameOrIndex: string | number) {
if (isString(nameOrIndex) && nameOrIndex in this.names) {
if (this.names[nameOrIndex].refCount > 1) {
this.names[nameOrIndex].refCount--;
return;
}
}
const index = this.findIndex(nameOrIndex);
if (index === this.curTex && (this.oldTexture || this.oldFrameBuffer)) {
throw new Error("Cannot remove current texture when set as render target");
}
const gl = this.rctx.getGl();
gl.deleteTexture(this.textures[index]);
this.textures.splice(index, 1);
if (this.curTex >= this.textures.length) {
this.curTex = this.textures.length - 1;
}
if (typeof nameOrIndex === "string") {
delete this.names[nameOrIndex];
}
}