toJSON() { const jsonLayer = {}; const { defaults, name } = this.constructor; const keys = Object.keys(defaults); for (let i = 0; i < keys.length; i++) { const key = keys[i]; if (key === 'deltas' || key === 'weights') continue; jsonLayer[key] = this[key]; } jsonLayer.type = name; return jsonLayer; }
/** * Checks whether the bitfield has a permission, or multiple permissions. * @param {PermissionResolvable} permission Permission(s) to check for * @param {boolean} [checkAdmin=true] Whether to allow the administrator permission to override * @returns {boolean} */ has(permission, checkAdmin = true) { return (checkAdmin && super.has(this.constructor.FLAGS.ADMINISTRATOR)) || super.has(permission); }
function validateSchemaErrorFormatter (schemaErrorFormatter) { if (typeof schemaErrorFormatter !== 'function') { throw new Error(`schemaErrorFormatter option should be a function, instead got ${typeof schemaErrorFormatter}`) } else if (schemaErrorFormatter.constructor.name === 'AsyncFunction') { throw new Error('schemaErrorFormatter option should not be an async function') } }
/** * @desc Returns the *pre-compiled* Kernel as a JS Object String, that can be reused. */ toString() { const setupContextString = `const gl = context || require('gl')(1, 1);\n`; const destroyContextString = ` if (!context) { gl.getExtension('STACKGL_destroy_context').destroy(); }\n`; return glKernelString(this.constructor, arguments, this, setupContextString, destroyContextString); }
get options() { return { ...(this.defaultOptions || {}), ...((this.polly.config.persisterOptions || {})[this.constructor.id] || {}) }; }
newListAdapter(key, { listAdapterClass, ...adapterConfig }) { const _listAdapterClass = listAdapterClass || this.config.listAdapterClass || this.constructor.defaultListAdapterClass; this.listAdapters[key] = new _listAdapterClass(key, this, adapterConfig); return this.listAdapters[key]; }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }
function warnNoop(publicInstance, callerName) { { var _constructor = publicInstance.constructor; var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; var warningKey = componentName + "." + callerName; if (didWarnStateUpdateForUnmountedComponent[warningKey]) { return; } error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); didWarnStateUpdateForUnmountedComponent[warningKey] = true; } }
function warnNoop(publicInstance, callerName) { { var _constructor = publicInstance.constructor; var componentName = _constructor && getComponentName(_constructor) || 'ReactClass'; var warningKey = componentName + '.' + callerName; if (didWarnAboutNoopUpdateForComponent[warningKey]) { return; } error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName); didWarnAboutNoopUpdateForComponent[warningKey] = true; } }
/** * Gets an {@link Array} of bitfield names based on the bits available. * @param {...*} hasParams Additional parameters for the has method, if any * @returns {string[]} */ toArray(...hasParams) { return Object.keys(this.constructor.FLAGS).filter(bit => this.has(bit, ...hasParams)); }
function constructorName(obj: mixed): string | null { return ( (obj && typeof obj.constructor === 'function' && obj.constructor.name && String(obj.constructor.name)) || null ); }
function hasPoolConstructor(obj: mixed): boolean { return ( // tslint:disable-next-line no-any (obj && typeof obj.constructor === 'function' && obj.constructor === (Pool as any).super_) || false ); }
/** * @param {*} val * @returns {boolean} */ function is_array(val){ return val.constructor === Array; }
/** * @desc Clones the Texture * @returns {Texture} */ clone() { throw new Error(`Not implemented on ${this.constructor.name}`); }
assert(message, ...args) { assert( `[${this.constructor.type}:${this.constructor.id}] ${message}`, ...args ); }