<commit_before>/* 

Note: At this time the plugin wrapper for this code is still under development.
It works with browsers that support foreignObject, but the logic for handling 
tspans in Internet Explorer and other browsers that don't support foreignObject
has not yet been refactored for the D3 plugin format. That code will work if
carefully transplanted to other projects, and you're welcome to harvest it and
apply it in that manner, but it can't yet simply be applied to a selection by
calling d3.textwrap(). I know that's kind of the whole point! That is the
eventual goal here, of course; stay tuned.

*/

(function() {

    // exit immediately if this has already been defined
    // as a function; the plugin will defer to whatever
    // else you're doing in your code
    if(typeof d3.selection.prototype.textwrap == 'function') {
        return false;
    }
    
    var force_wrap_method;
    // set this variable to a string value to always force a particular
    // wrap method for development purposes. set to 'tspan' to 
    // use tspans and 'foreignobject' to use foreignobject
    // force_wrap_method = 'tspans'; // uncomment statement to use tspans
    // force_wrap_method = 'foreignobjects'; // uncomment statement to use foreignobjects
    force_wrap_method = false; // by default no wrap method is forced

    // create the plugin method twice, both for regular use
    // and again for use inside the enter() selection
    d3.selection.prototype.textwrap = d3.selection.enter.prototype.textwrap = function(bounds) {
    
        // save callee into a variable so we can continue to refer to it 
        // as the function scope changes
        var selection = this;
        
        // extract wrap boundaries from any d3-selected rect and return them
        // in a format that matches the simpler object argument option<commit_msg>don't check typeof when deferring<commit_after>/* 

Note: At this time the plugin wrapper for this code is still under development.
It works with browsers that support foreignObject, but the logic for handling 
tspans in Internet Explorer and other browsers that don't support foreignObject
has not yet been refactored for the D3 plugin format. That code will work if
carefully transplanted to other projects, and you're welcome to harvest it and
apply it in that manner, but it can't yet simply be applied to a selection by
calling d3.textwrap(). I know that's kind of the whole point! That is the
eventual goal here, of course; stay tuned.

*/

(function() {

    // exit immediately if this has already been defined
    // as a function; the plugin will defer to whatever
    // else you're doing in your code
    if(d3.selection.prototype.textwrap) {
        return false;
    }
    
    var force_wrap_method;
    // set this variable to a string value to always force a particular
    // wrap method for development purposes. set to 'tspan' to 
    // use tspans and 'foreignobject' to use foreignobject
    // force_wrap_method = 'tspans'; // uncomment statement to use tspans
    // force_wrap_method = 'foreignobjects'; // uncomment statement to use foreignobjects
    force_wrap_method = false; // by default no wrap method is forced

    // create the plugin method twice, both for regular use
    // and again for use inside the enter() selection
    d3.selection.prototype.textwrap = d3.selection.enter.prototype.textwrap = function(bounds) {
    
        // save callee into a variable so we can continue to refer to it 
        // as the function scope changes
        var selection = this;
        
        // extract wrap boundaries from any d3-selected rect and return them
        // in a format that matches the simpler object argument option
{'fraction_non_alphanumeric': 0.058791946308724835, 'fraction_numerical': 0.003221476510067114, 'mean_word_length': 3.0324675324675323, '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': '3159866', 'n_tokens_mistral': 961, 'n_tokens_neox': 914, 'n_words': 489}