<commit_before>'use strict';


function fromArray(pairs) {
    // [(String, a)] -> Error e (Map String a)
    var obj = {};
    pairs.map(function(p) {
        var key = p[0],
            val = p[1];
        if ( obj.hasOwnProperty(key) ) {
            throw new Error('duplicate key: ' + key);
        }
        obj[key] = val;
    });
    return obj;
}

function toArray(obj) {
    // question: include key/val pairs on prototypes as well?
    throw new Error('oops');
}

function squash(obj) {
    // create new object which includes properties from entire prototype chain
    // question:  *all* of them?
    throw new Error('oops');
}


module.exports = {
    'fromArray': fromArray,
    'toArray': toArray
};
<commit_msg>clarify API stub of objects module<commit_after>'use strict';


// error conditions: repeated key
// q: what to do if dupe key?
// a: (for now) throw error
function fromArray(pairs) {
    // [(String, a)] -> Error e (Map String a)
    var obj = {};
    pairs.map(function(p) {
        var key = p[0],
            val = p[1];
        if ( obj.hasOwnProperty(key) ) {
            throw new Error('duplicate key: ' + key);
        }
        obj[key] = val;
    });
    return obj;
}

function toArray(obj) {
    // q: include all key/val, or just own?
    // a: maybe let `squash` worry about all?  so just do own here
    throw new Error('oops');
}

function squash(obj) {
    // create new object which includes properties from entire prototype chain
    // q:  *all* of them? including non-enumerable, overridden, etc.
    // a: yes, *all*
    // maybe return value is {'key': [...list of values...]}
    throw new Error('oops');
}

function fmap(f, obj) {
    // q: all values, or just own values?
    // a: just own values -- don't want to worry about prototype chain
}


module.exports = {
    'fromArray': fromArray,
    'toArray': toArray
};

{'fraction_non_alphanumeric': 0.14194236926360726, 'fraction_numerical': 0.0021344717182497333, 'mean_word_length': 2.324468085106383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5725311', 'n_tokens_mistral': 604, 'n_tokens_neox': 595, 'n_words': 202}