<commit_before>import xyBase from '../xyBase';
import { glLine, scaleMapper } from '@d3fc/d3fc-webgl';
import { rebindAll, exclude, rebind } from '@d3fc/d3fc-rebind';

export default () => {
    const base = xyBase();
    let context = null;

    const draw = glLine();

    const line = (data) => {
        const xScale = scaleMapper(base.xScale());
        const yScale = scaleMapper(base.yScale());

        const accessor = getAccessors();

        const x = new Float32Array(data.length);
        const y = new Float32Array(data.length);
        const defined = new Float32Array(data.length);

        data.forEach((d, i) => {
            x[i] = xScale.scale(accessor.x(d, i));
            y[i] = yScale.scale(accessor.y(d, i));
            defined[i] = accessor.defined(d, i);
        });

        draw.xValues(x)
            .yValues(y)
            .defined(defined)
            .xScale(xScale.glScale)
            .yScale(yScale.glScale)
            .decorate((program) => {
                base.decorate()(program, data, 0);
            });

        draw(data.length);
    };

    function getAccessors() {
        if (base.orient() === 'vertical') {
            return {
                x: base.crossValue(),
                y: base.mainValue(),
                defined: base.defined()
            };
        } else {
            return {
                x: base.mainValue(),
                y: base.crossValue(),
                defined: base.defined()
            };
        }
    }

    line.context = (...args) => {
        if (!args.length) {
            return context;
        }
        context = args[0];
        return line;
    };

    rebindAll(line, base, exclude('baseValue', 'bandwidth', 'align'));
    rebind(line, draw, 'context', 'lineWidth');

    return line;
};<commit_msg>chore: remove unused context function<commit_after>import xyBase from '../xyBase';
import { glLine, scaleMapper } from '@d3fc/d3fc-webgl';
import { rebindAll, exclude, rebind } from '@d3fc/d3fc-rebind';

export default () => {
    const base = xyBase();

    const draw = glLine();

    const line = (data) => {
        const xScale = scaleMapper(base.xScale());
        const yScale = scaleMapper(base.yScale());

        const accessor = getAccessors();

        const x = new Float32Array(data.length);
        const y = new Float32Array(data.length);
        const defined = new Float32Array(data.length);

        data.forEach((d, i) => {
            x[i] = xScale.scale(accessor.x(d, i));
            y[i] = yScale.scale(accessor.y(d, i));
            defined[i] = accessor.defined(d, i);
        });

        draw.xValues(x)
            .yValues(y)
            .defined(defined)
            .xScale(xScale.glScale)
            .yScale(yScale.glScale)
            .decorate((program) => {
                base.decorate()(program, data, 0);
            });

        draw(data.length);
    };

    function getAccessors() {
        if (base.orient() === 'vertical') {
            return {
                x: base.crossValue(),
                y: base.mainValue(),
                defined: base.defined()
            };
        } else {
            return {
                x: base.mainValue(),
                y: base.crossValue(),
                defined: base.defined()
            };
        }
    }

    rebindAll(line, base, exclude('baseValue', 'bandwidth', 'align'));
    rebind(line, draw, 'context', 'lineWidth');

    return line;
};
{'fraction_non_alphanumeric': 0.1481159420289855, 'fraction_numerical': 0.006666666666666667, 'mean_word_length': 1.7130503144654088, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '6631382', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1018, 'n_words': 215}