{"size": 1926, "ext": "js", "max_stars_repo_path": "node_modules/jsdoc/lib/jsdoc/tag/dictionary.js", "max_stars_repo_name": "quanhoang-bhtech/3dcitydb-web-map", "max_stars_repo_stars_event_min_datetime": "2015-09-18T14:59:06.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T16:05:38.000Z", "max_issues_repo_path": "node_modules/jsdoc/lib/jsdoc/tag/dictionary.js", "max_issues_repo_name": "quanhoang-bhtech/3dcitydb-web-map", "max_issues_repo_issues_event_min_datetime": "2016-01-26T13:11:01.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-12T23:42:36.000Z", "max_forks_repo_path": "node_modules/jsdoc/lib/jsdoc/tag/dictionary.js", "max_forks_repo_name": "quanhoang-bhtech/3dcitydb-web-map", "max_forks_repo_forks_event_min_datetime": "2015-10-09T16:38:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T09:39:06.000Z"}
{"max_stars_count": 289, "max_issues_count": 63, "max_forks_count": 110, "avg_line_length": 22.3953488372, "max_line_length": 82, "alphanum_fraction": 0.5841121495}
/**
    @overview
    @author Michael Mathews <micmath@gmail.com>
    @license Apache License 2.0 - See file 'LICENSE.md' in this project.
 */
'use strict';

var hasOwnProp = Object.prototype.hasOwnProperty;

var _tags = {};
var _tagSynonyms = {};
var _namespaces = [];
var dictionary;

/** @private */
function TagDefinition(title, etc) {
    var self = this;
    etc = etc || {};

    this.title = dictionary.normalise(title);

    Object.keys(etc).forEach(function(p) {
        self[p] = etc[p];
    });
}

/** @private */
TagDefinition.prototype.synonym = function(synonymName) {
    _tagSynonyms[synonymName.toLowerCase()] = this.title;
    return this; // chainable
};

/** @exports jsdoc/tag/dictionary */
dictionary = {
    /** @function */
    defineTag: function(title, opts) {
        var def = new TagDefinition(title, opts);
        // all the other dictionary functions use normalised names; we should too.
        _tags[def.title] = def;

        if (opts && opts.isNamespace) {
            _namespaces.push(def.title);
        }

        return _tags[def.title];
    },

    /** @function */
    lookUp: function(title) {
        title = dictionary.normalise(title);

        if ( hasOwnProp.call(_tags, title) ) {
           return _tags[title];
        }

        return false;
    },

    /** @function */
    isNamespace: function(kind) {
        if (kind) {
            kind = dictionary.normalise(kind);
            if ( _namespaces.indexOf(kind) !== -1) {
                return true;
            }
        }

        return false;
    },

    /** @function */
    normalise: function(title) {
        var canonicalName = title.toLowerCase();

        if ( hasOwnProp.call(_tagSynonyms, canonicalName) ) {
            return _tagSynonyms[canonicalName];
        }

        return canonicalName;
    }
};

require('jsdoc/tag/dictionary/definitions').defineTags(dictionary);

module.exports = dictionary;
