util#isString TypeScript Examples
The following examples show how to use
util#isString.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: node-type.decorator.ts From nestjs-relay with MIT License | 6 votes |
export function NodeType<T extends AnyConstructor<T>>(
nameOrOptions?: string | ObjectTypeOptions,
objectTypeOptions?: ObjectTypeOptions,
): ClassDecorator {
// eslint-disable-next-line @typescript-eslint/ban-types
return (target: Function) => {
const [name, options = {}] = isString(nameOrOptions)
? [nameOrOptions, objectTypeOptions]
: [target.name, nameOrOptions];
const interfaces = options.implements ? [].concat(options.implements as never) : [];
const nodeOptions: ObjectTypeOptions = {
...options,
implements: interfaces.concat(NodeInterface as never),
};
MetadataStorage.addClassMetadata({ name, target });
ObjectType(name, nodeOptions)(target);
};
}
Example #2
Source File: process.decorator.ts From nestjs-bullmq with MIT License | 5 votes |
export function Process(
nameOrOptions?: string | ProcessOptions,
): MethodDecorator {
const options = isString(nameOrOptions)
? { name: nameOrOptions }
: nameOrOptions;
return SetMetadata(BULL_MODULE_QUEUE_PROCESS, options || {});
}
Example #3
Source File: parser.ts From vscode-rss with MIT License | 5 votes |
function isStringified(s: any) {
return isString(s) || isNumber(s);
}