<commit_before>﻿namespace MakerJs.models {

    /**
     * @private
     */
    var hasLib = false;

    /**
     * @private
     */
    function ensureBezierLib() {

        if (hasLib) return;

        try {
            var lib = Bezier.prototype;
            hasLib = true;
        }
        catch (e) {
            throw "Bezier library not found. If you are using Node, try running 'npm install' or if you are in the browser, download http://pomax.github.io/bezierjs/bezier.js to your website and add a script tag.";
        }
    }

    /**
     * @private
     */
    var scratch: BezierJs.Bezier;

    /**
     * @private
     */
    function getScratch(seed: IPathBezierSeed) {

        var points: IPoint[] = [seed.origin];
        points.push.apply(points, seed.controls);
        points.push(seed.end);

        var bezierJsPoints = points.map(function (p: IPoint) {
            var bp: BezierJs.Point = {
                x: p[0], y: p[1]
            };
            return bp;
        });

        if (!scratch) {

            ensureBezierLib();
            scratch = new Bezier(bezierJsPoints);
        } else {
            scratch.points = bezierJsPoints;
            scratch.update();
        }
<commit_msg>invoke constructor on existing Bezier object instance<commit_after>﻿namespace MakerJs.models {

    /**
     * @private
     */
    var hasLib = false;

    /**
     * @private
     */
    function ensureBezierLib() {

        if (hasLib) return;

        try {
            var lib = Bezier.prototype;
            hasLib = true;
        }
        catch (e) {
            throw "Bezier library not found. If you are using Node, try running 'npm install' or if you are in the browser, download http://pomax.github.io/bezierjs/bezier.js to your website and add a script tag.";
        }
    }

    /**
     * @private
     */
    var scratch: BezierJs.Bezier;

    /**
     * @private
     */
    function getScratch(seed: IPathBezierSeed) {

        var points: IPoint[] = [seed.origin];
        points.push.apply(points, seed.controls);
        points.push(seed.end);

        var bezierJsPoints = points.map(function (p: IPoint) {
            var bp: BezierJs.Point = {
                x: p[0], y: p[1]
            };
            return bp;
        });

        if (!scratch) {

            ensureBezierLib();
            scratch = new Bezier(bezierJsPoints);
        } else {
            //invoke the constructor on the same object
            Bezier.apply(scratch, bezierJsPoints);
        }

{'fraction_non_alphanumeric': 0.1136724960254372, 'fraction_numerical': 0.001589825119236884, 'mean_word_length': 1.5762538382804503, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3918408', 'n_tokens_mistral': 774, 'n_tokens_neox': 737, 'n_words': 192}