<commit_before>module.exports = Hash;
var Traverse = require('traverse');

function Hash (hash, extra) {
    var self = {
        map : function (f) {
            var acc = { __proto__ : hash.__proto__ };
            Object.keys(hash).forEach(function (key) {
                acc[key] = f.call(hash, hash[key], key);
            });
            return Hash(acc);
        },
        forEach : function (f) {
            Object.keys(hash).forEach(function (key) {
                f.call(hash, hash[key], key);
            });
            memoized = {};
            return self;
        },
        filter : function (f) {
            var acc = { __proto__ : hash.__proto__ };
            Object.keys(hash).forEach(function (key) {
                if (f.call(hash, hash[key], key)) {
                    acc[key] = hash[key];
                }
            });
            return Hash(acc);
        },
        reduce : function (f, acc) {
            var keys = Object.keys(hash);
            if (acc === undefined) acc = keys.shift();
            keys.forEach(function (key) {
                acc = f.call(hash, acc, hash[key], key);
            });
            return acc;
        },
        update : function (h) {
            Object.keys(h).forEach(function (key) {
                hash[key] = h[key];
            });
            memoized = {};
            return self;
        },
        merge : function (h) {
            return self.copy.update(h);
        },
        tap : function (f) {
            f.call(self, hash);
            memoized = {};
        },
        end : hash,
        items : hash
    };
    
    var memoized = {};
    Object.defineProperty(self, 'keys', { get : function () {
        if (memoized.keys === undefined) {
            memoized.keys = Object.keys(hash);
        }
        return memoized.keys
    } });
    
    Object.defineProperty(self, 'values', { get : function () {
        if (memoized.values === undefined) {
            memoized.values = Object.keys(hash)
                .map(function (key) { return hash[key] });
        }
        return memoized.values;
    } });
    
    Object.defineProperty(self, 'clone', { get : function () {
        return Hash(Hash.clone(hash));
    } });
    
    Object.defineProperty(self, 'copy', { get : function () {
        return Hash(Hash.copy(hash));
    } });
    <commit_msg>hash example, some()<commit_after>module.exports = Hash;
var Traverse = require('traverse');

function Hash (hash, extra) {
    var self = {
        map : function (f) {
            var acc = { __proto__ : hash.__proto__ };
            Object.keys(hash).forEach(function (key) {
                acc[key] = f.call(hash, hash[key], key);
            });
            return Hash(acc);
        },
        forEach : function (f) {
            Object.keys(hash).forEach(function (key) {
                f.call(hash, hash[key], key);
            });
            memoized = {};
            return self;
        },
        filter : function (f) {
            var acc = { __proto__ : hash.__proto__ };
            Object.keys(hash).forEach(function (key) {
                if (f.call(hash, hash[key], key)) {
                    acc[key] = hash[key];
                }
            });
            return Hash(acc);
        },
        reduce : function (f, acc) {
            var keys = Object.keys(hash);
            if (acc === undefined) acc = keys.shift();
            keys.forEach(function (key) {
                acc = f.call(hash, acc, hash[key], key);
            });
            return acc;
        },
        some : function (f) {
            for (var key in hash) {
                if (f.call(self, hash[key], key)) return true;
            }
            return false;
        },
        update : function (h) {
            Object.keys(h).forEach(function (key) {
                hash[key] = h[key];
            });
            memoized = {};
            return self;
        },
        merge : function (h) {
            return self.copy.update(h);
        },
        tap : function (f) {
            f.call(self, hash);
            memoized = {};
            return self;
        },
        end : hash,
        items : hash
    };
    
    var memoized = {};
    Object.defineProperty(self, 'keys', { get : function () {
        if (memoized.keys === undefined) {
            memoized.keys = Object.keys(hash);
        }
        return memoized.keys
    } });
    
    Object.defineProperty(self, 'values', { get : function () {
        if (memoized.values === undefined) {
            memoized.values = Object.keys(hash)
                .map(function (key) { return hash[key] });
        }
        return memoized.values;
    } });
    
    Object.defineProperty(self, 'clone', { get : function () {
        return Hash(Hash.clone(hash));
    } });
    
    Object.defineProperty(self, 'copy', { get : function () {
        return Hash(Hash.copy(hash));
    } });
    
{'fraction_non_alphanumeric': 0.14462474645030426, 'fraction_numerical': 0.0, 'mean_word_length': 1.3878934624697337, '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': '6758868', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1384, 'n_words': 300}