<commit_before>/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var isNumeric = require('fast-isnumeric');
var rgba = require('color-rgba');

var Colorscale = require('../components/colorscale');
var colorDflt = require('../components/color/attributes').defaultLine;

var colorDfltRgba = rgba(colorDflt);
var opacityDflt = 1;

function calculateColor(colorIn, opacityIn) {
    var colorOut = colorIn;
    colorOut[3] *= opacityIn;
    return colorOut;
}

function validateColor(colorIn) {
    return rgba(colorIn) || colorDfltRgba;
}

function validateOpacity(opacityIn) {
    return isNumeric(opacityIn) ? opacityIn : opacityDflt;
}

function formatColor(containerIn, opacityIn, len) {
    var colorIn = containerIn.color,
        isArrayColorIn = Array.isArray(colorIn),
        isArrayOpacityIn = Array.isArray(opacityIn),
        colorOut = [];

    var sclFunc, getColor, getOpacity, colori, opacityi;

    if(containerIn.colorscale !== undefined) {
        sclFunc = Colorscale.makeColorScaleFunc(
            Colorscale.extractScale(
                containerIn.colorscale,
                containerIn.cmin,
                containerIn.cmax
            )
        );
    }
    else {
        sclFunc = function (c) {
            return c;
        };
    }

    if(isArrayColorIn) {
        getColor = function(c, i) {
            return c[i] === undefined ? colorDfltRgba : rgba(sclFunc(c[i]));
        };<commit_msg>Fix lint<commit_after>/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/


'use strict';

var isNumeric = require('fast-isnumeric');
var rgba = require('color-rgba');

var Colorscale = require('../components/colorscale');
var colorDflt = require('../components/color/attributes').defaultLine;

var colorDfltRgba = rgba(colorDflt);
var opacityDflt = 1;

function calculateColor(colorIn, opacityIn) {
    var colorOut = colorIn;
    colorOut[3] *= opacityIn;
    return colorOut;
}

function validateColor(colorIn) {
    return rgba(colorIn) || colorDfltRgba;
}

function validateOpacity(opacityIn) {
    return isNumeric(opacityIn) ? opacityIn : opacityDflt;
}

function formatColor(containerIn, opacityIn, len) {
    var colorIn = containerIn.color,
        isArrayColorIn = Array.isArray(colorIn),
        isArrayOpacityIn = Array.isArray(opacityIn),
        colorOut = [];

    var sclFunc, getColor, getOpacity, colori, opacityi;

    if(containerIn.colorscale !== undefined) {
        sclFunc = Colorscale.makeColorScaleFunc(
            Colorscale.extractScale(
                containerIn.colorscale,
                containerIn.cmin,
                containerIn.cmax
            )
        );
    }
    else {
        sclFunc = function(c) {
            return c;
        };
    }

    if(isArrayColorIn) {
        getColor = function(c, i) {
            return c[i] === undefined ? colorDfltRgba : rgba(sclFunc(c[i]));
        };
{'fraction_non_alphanumeric': 0.11139240506329114, 'fraction_numerical': 0.006329113924050633, 'mean_word_length': 2.822249093107618, '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': '6784820', 'n_tokens_mistral': 1021, 'n_tokens_neox': 968, 'n_words': 224}