<commit_before>// Type definitions for lru-cache 4.1
// Project: https://github.com/isaacs/node-lru-cache
// Definitions by: <NAME> <https://github.com/Bartvds>
//                 BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

export = LRU;

declare const LRU: LRU;

interface LRU {
    <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
    <K, V>(max: number): LRU.Cache<K, V>;
    new <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
    new <K, V>(max: number): LRU.Cache<K, V>;
}

declare namespace LRU {
    interface Options<K = any, V = any> {
        /**
         * The maximum size of the cache, checked by applying the length
         * function to all values in the cache. Not setting this is kind of silly,
         * since that's the whole purpose of this lib, but it defaults to `Infinity`.
         */
        max?: number;

        /**
         * Maximum age in ms. Items are not pro-actively pruned out as they age,
         * but if you try to get an item that is too old, it'll drop it and return
         * undefined instead of giving it to you.
         */
        maxAge?: number;

        /**
         * Function that is used to calculate the length of stored items.
         * If you're storing strings or buffers, then you probably want to do
         * something like `function(n, key){return n.length}`. The default
         * is `function(){return 1}`, which is fine if you want to store
         * `max` like-sized things. The item is passed as the first argument,
         * and the key is passed as the second argument.
         */
        length?(value: V): number;

        /**
         * Function that is called on items when they are dropped from the cache.
         * This can be handy if you want to close file descriptors or do other
         * cleanup tasks when items are no longer accessible. Called with `key, value`.
         * It's called before actually removing the item from the internal cache,
         * so if you want to immediately put it back in, you'll have to do that in<commit_msg>add the missing `key` arg for `length()`<commit_after>// Type definitions for lru-cache 4.1
// Project: https://github.com/isaacs/node-lru-cache
// Definitions by: <NAME> <https://github.com/Bartvds>
//                 BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

export = LRU;

declare const LRU: LRU;

interface LRU {
    <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
    <K, V>(max: number): LRU.Cache<K, V>;
    new <K, V>(opts?: LRU.Options<K, V>): LRU.Cache<K, V>;
    new <K, V>(max: number): LRU.Cache<K, V>;
}

declare namespace LRU {
    interface Options<K = any, V = any> {
        /**
         * The maximum size of the cache, checked by applying the length
         * function to all values in the cache. Not setting this is kind of silly,
         * since that's the whole purpose of this lib, but it defaults to `Infinity`.
         */
        max?: number;

        /**
         * Maximum age in ms. Items are not pro-actively pruned out as they age,
         * but if you try to get an item that is too old, it'll drop it and return
         * undefined instead of giving it to you.
         */
        maxAge?: number;

        /**
         * Function that is used to calculate the length of stored items.
         * If you're storing strings or buffers, then you probably want to do
         * something like `function(n, key){return n.length}`. The default
         * is `function(){return 1}`, which is fine if you want to store
         * `max` like-sized things. The item is passed as the first argument,
         * and the key is passed as the second argument.
         */
        length?(value: V, key?: K): number;

        /**
         * Function that is called on items when they are dropped from the cache.
         * This can be handy if you want to close file descriptors or do other
         * cleanup tasks when items are no longer accessible. Called with `key, value`.
         * It's called before actually removing the item from the internal cache,
         * so if you want to immediately put it back in, you'll have to do that in
{'fraction_non_alphanumeric': 0.10376044568245125, 'fraction_numerical': 0.002321262766945218, 'mean_word_length': 2.322282189668466, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 8, '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': '7119897', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1212, 'n_words': 543}