<commit_before>'use strict';

/**
 * Requirements
 * @ignore
 */
const Filter = require('./Filter.js').Filter;
const isPlainObject = require('lodash.isplainobject');


/**
 * Generates a link url fro the given link object.
 * This serves as a integration helper for cms's
 *
 * @memberOf nunjucks.filter
 */
class LinkUrlFilter extends Filter
{
    /**
     * @inheritDocs
     */
    constructor(dataProperties)
    {
        super();
        this._name = 'linkUrl';

        // Assign options
        this.dataProperties = dataProperties || [];
    }


    /**
     * @inheritDocs
     */
    static get injections()
    {
        return { 'parameters': ['nunjucks.filter/LinkUrlFilter.dataProperties'] };
    }


    /**
     * @inheritDocs
     */
    static get className()
    {
        return 'nunjucks.filter/LinkUrlFilter';
    }


    /**
     * @inheritDocs
     */
    filter()
    {
        const scope = this;
        return function(value)
        {
            if (typeof value === 'string')
            {
                return value;
            }
            if (isPlainObject(value))
            {
                for (const dataProperty of scope.dataProperties)
                {
                    if (typeof value[dataProperty] === 'string')
                    {
                        return value[dataProperty];
                    }
                }
            }
            return 'JavaScript:;';
        };
    }
}


/**
 * Exports
 * @ignore
 */
module.exports.LinkUrlFilter = LinkUrlFilter;
<commit_msg>fix(nunjucks.filter.LinkUrlFilter): adds alternativ name link<commit_after>'use strict';

/**
 * Requirements
 * @ignore
 */
const Filter = require('./Filter.js').Filter;
const isPlainObject = require('lodash.isplainobject');


/**
 * Generates a link url fro the given link object.
 * This serves as a integration helper for cms's
 *
 * @memberOf nunjucks.filter
 */
class LinkUrlFilter extends Filter
{
    /**
     * @inheritDocs
     */
    constructor(dataProperties)
    {
        super();
        this._name = ['linkUrl', 'link'];

        // Assign options
        this.dataProperties = dataProperties || [];
    }


    /**
     * @inheritDocs
     */
    static get injections()
    {
        return { 'parameters': ['nunjucks.filter/LinkUrlFilter.dataProperties'] };
    }


    /**
     * @inheritDocs
     */
    static get className()
    {
        return 'nunjucks.filter/LinkUrlFilter';
    }


    /**
     * @inheritDocs
     */
    filter()
    {
        const scope = this;
        return function(value)
        {
            if (typeof value === 'string')
            {
                return value;
            }
            if (isPlainObject(value))
            {
                for (const dataProperty of scope.dataProperties)
                {
                    if (typeof value[dataProperty] === 'string')
                    {
                        return value[dataProperty];
                    }
                }
            }
            return 'JavaScript:;';
        };
    }
}


/**
 * Exports
 * @ignore
 */
module.exports.LinkUrlFilter = LinkUrlFilter;

{'fraction_non_alphanumeric': 0.1206126356094448, 'fraction_numerical': 0.0, 'mean_word_length': 1.520096463022508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7473158', 'n_tokens_mistral': 889, 'n_tokens_neox': 846, 'n_words': 179}