How to use the catharsis.Types function in catharsis

To help you get started, we’ve selected a few catharsis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wingedfox / dgeni-alive / src / services / getTypeName.js View on Github external
function TypeName (typeStr) {
        var type;
        var typeName = typeStr;
        try {
            if ('Function' == typeName) {
                typeName = '{' + typeName + '}';
            }
            type = catharsis.parse(typeName);
            if (type.type === catharsis.Types.TypeApplication && (type.expression.name === 'Array' || type.expression.name === 'Object')) {
                typeName = type.applications[0].name;
            } else if (type.type === catharsis.Types.FunctionType) {
                typeName = 'Function';
                type = null;
            } else {
                typeName = typeStr;
                type = null;
            }
        } catch (e) {
//            log.error('getTypeName: Parse of "%s" failed with reason: %s', typeStr, e.message);
            typeName = typeStr;
        }

        var doc = aliasMap.getDocs(typeName);
        var res = '';

        if (doc.length === 1) {
            doc = doc[0];
github wingedfox / dgeni-alive / src / services / getTypeLink.js View on Github external
function TypeLink (typeStr) {
        var type;
        var typeName = typeStr;
        try {
            if ('Function' == typeName) {
                typeName = '{' + typeName + '}';
            }
            type = catharsis.parse(typeName);
            if (type.type === catharsis.Types.TypeApplication && (type.expression.name === 'Array' || type.expression.name === 'Object')) {
                typeName = type.applications[0].name;
            } else if (type.type === catharsis.Types.FunctionType) {
                typeName = 'Function';
                type = null;
            } else {
                typeName = typeStr;
                type = null;
            }
        } catch (e) {
//            log.error('getTypeName: Parse of "%s" failed with reason: %s', typeStr, e.message);
            typeName = typeStr;
        }

        var doc = aliasMap.getDocs(typeName);
        var res = '';
github BladeRunnerJS / brjs / brjs-sdk / build-resources / includes / sdk / jsdoc-toolkit-resources / jsdoc-toolkit / lib / jsdoc / tag / type.js View on Github external
function getTypeStrings(parsedType, isOutermostType) {
    var applications;
    var typeString;

    var types = [];

    var TYPES = catharsis.Types;

    switch(parsedType.type) {
        case TYPES.AllLiteral:
            types.push('*');
            break;
        case TYPES.FunctionType:
            types.push('function');
            break;
        case TYPES.NameExpression:
            types.push(parsedType.name);
            break;
        case TYPES.NullLiteral:
            types.push('null');
            break;
        case TYPES.RecordType:
            types.push('Object');
github melonjs / melonJS / tasks / jsdoc / lib / jsdoc / tag / type.js View on Github external
function getTypeStrings(parsedType) {
    var types = [];

    var catharsis = require('catharsis');
    var TYPES = catharsis.Types;
    var util = require('util');

    switch(parsedType.type) {
        case TYPES.AllLiteral:
            types.push('*');
            break;
        case TYPES.FunctionType:
            types.push('function');
            break;
        case TYPES.NameExpression:
            types.push(parsedType.name);
            break;
        case TYPES.NullLiteral:
            types.push('null');
            break;
        case TYPES.RecordType:
github wingedfox / dgeni-alive / src / packages / ngdoc-ext / services / getTypeLink.js View on Github external
function TypeLink (typeStr) {
        var typeName = typeStr;
        try {
            log.debug('[getTypeLink] building type link for %s', typeStr);
            var type = catharsis.parse(typeName, {jsdoc: true});
            if (type.type === catharsis.Types.TypeApplication) {
                typeName = catharsis.stringify(type.applications[0], {restringify: true});
                type = _.clone(type);
                type.applications = type.applications.map(function (type) {
                    if (type.type !== catharsis.Types.FunctionType && type.type !== catharsis.Types.UndefinedLiteral) {
                        type.name = getLinkInfo(type.name).title;
                    }
                    return type;
                });
            } else {
                if (type.type !== catharsis.Types.FunctionType && type.type !== catharsis.Types.UndefinedLiteral) {
                    typeName = type.name;
                    type = _.clone(type);
                    type.name = getLinkInfo(type.name).title;
                }
            }
            typeStr = catharsis.stringify(type, {restringify: true});
        } catch (e) {
            log.error('[getTypeLink] Parse of "%s" failed with reason: %s', typeStr, e.message);
            typeName = typeStr;
        }
        var res = _.template('{@link ${link} ${title}}')({link: typeName, title: typeStr});
        log.silly('[getTypeLink] built link %s', res);
        return res;
    };
github angular / dgeni-packages / jsdoc / services / transforms / extract-type.js View on Github external
function getTypeStrings(parsedType) {
    var types = [];

    var TYPES = catharsis.Types;
    var util = require('util');

    switch(parsedType.type) {
      case TYPES.AllLiteral:
        types.push('*');
        break;
      case TYPES.FunctionType:
        types.push(catharsis.stringify(parsedType));
        break;
      case TYPES.NameExpression:
        types.push(parsedType.name);
        break;
      case TYPES.NullLiteral:
        types.push('null');
        break;
      case TYPES.RecordType:
github jsdoc / jsdoc / packages / jsdoc / lib / jsdoc / tag / type.js View on Github external
function getTypeStrings(parsedType, isOutermostType) {
    let applications;
    let typeString;

    let types = [];

    const TYPES = catharsis.Types;

    switch (parsedType.type) {
        case TYPES.AllLiteral:
            types.push('*');
            break;
        case TYPES.FunctionType:
            types.push('function');
            break;
        case TYPES.NameExpression:
            types.push(parsedType.name);
            break;
        case TYPES.NullLiteral:
            types.push('null');
            break;
        case TYPES.RecordType:
            types.push('Object');
github BladeRunnerJS / brjs / brjs-sdk / sdk / jsdoc-toolkit-resources / jsdoc-toolkit / lib / jsdoc / tag / type.js View on Github external
function getTypeStrings(parsedType, isOutermostType) {
    var applications;
    var typeString;

    var types = [];

    var TYPES = catharsis.Types;

    switch (parsedType.type) {
        case TYPES.AllLiteral:
            types.push('*');
            break;
        case TYPES.FunctionType:
            types.push('function');
            break;
        case TYPES.NameExpression:
            types.push(parsedType.name);
            break;
        case TYPES.NullLiteral:
            types.push('null');
            break;
        case TYPES.RecordType:
            types.push('Object');

catharsis

A JavaScript parser for Google Closure Compiler and JSDoc type expressions.

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis

Similar packages