<commit_before>(function() {
    'use strict';
    var root = this;
    var previous = root.Chainable;

    root.Chainable = (function () {

        function Chainable(initialStorage) {
            var storage = initialStorage;
            if (!(this instanceof Chainable)) {
                return new Chainable(initialStorage);
            }

            this.chain = function (cb, extraArguments, context) {
                storage = cb.apply(context || this, [storage].concat(extraArguments));
                return this;
            };
            this.value = function () {
                return storage;
            };
        }
<commit_msg>Changed behaviour: Instead of storing initial value directly, shallow copy is created when value is either Array or Object<commit_after>(function () {
    'use strict';
    var root = this;
    var previous = root.Chainable;

    function copyShallow(source) {
        var
            objCopy = {},
            prop;
        if (typeof source !== 'object') {
            return source;
        }
        else if (Object.prototype.toString.call(source) === '[object Array]') {
            return source.slice();
        }
        for (prop in source) {
            if (source.hasOwnProperty(prop)) {
                objCopy[prop] = source[prop];
            }
        }
        return objCopy;
    }

    root.Chainable = (function () {

        function Chainable(initialStorage) {
            var storage;
            if (!(this instanceof Chainable)) {
                return new Chainable(initialStorage);
            }
            storage = copyShallow(initialStorage);

            this.chain = function (cb, extraArguments, context) {
                storage = cb.apply(context || this, [storage].concat(extraArguments));
                return this;
            };
            this.value = function () {
                return storage;
            };
        }

{'fraction_non_alphanumeric': 0.1032325338894682, 'fraction_numerical': 0.0, 'mean_word_length': 1.607336956521739, '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': '7095051', 'n_tokens_mistral': 470, 'n_tokens_neox': 453, 'n_words': 123}