<commit_before>'use strict';

function StringPrimitives() {
    Primitives.call(this);
    var _this = this;

    function _concat(frame, args) {
        var argument = args[1];
        return universe.newString(args[0].getEmbeddedString()
            + argument.getEmbeddedString());
    }

    function _asSymbol(frame, args) {
        return universe.symbolFor(args[0].getEmbeddedString());
    }

    function _length(frame, args) {
        return universe.newInteger(args[0].getEmbeddedString().length);
    }

    function _equals(frame, args) {
        var op1 = args[1];
        var op2 = args[0];
        if (op1 instanceof SString) {
            if (op1.getEmbeddedString() == op2.getEmbeddedString()) {
                return som.trueObject;
            }
            return som.falseObject;
        }
    }

    function _substring(frame, args) {
        var end   = args[2];
        var start = args[1];

        var s = start.getEmbeddedInteger() - 1;
        var e = end.getEmbeddedInteger();
        var string = args[0].getEmbeddedString();

        if (s < 0  ||  s >= string.length  ||  e > string.length  ||  e < s) {
            return universe.newString("Error - index out of bounds");
        } else {
            return universe.newString(string.substring(s, e));
        }
    }
<commit_msg>Fixed primitive not returning a value<commit_after>'use strict';

function StringPrimitives() {
    Primitives.call(this);
    var _this = this;

    function _concat(frame, args) {
        var argument = args[1];
        return universe.newString(args[0].getEmbeddedString()
            + argument.getEmbeddedString());
    }

    function _asSymbol(frame, args) {
        return universe.symbolFor(args[0].getEmbeddedString());
    }

    function _length(frame, args) {
        return universe.newInteger(args[0].getEmbeddedString().length);
    }

    function _equals(frame, args) {
        var op1 = args[1];
        var op2 = args[0];
        if (op1 instanceof SString) {
            if (op1.getEmbeddedString() == op2.getEmbeddedString()) {
                return som.trueObject;
            }
        }
        return som.falseObject;
    }

    function _substring(frame, args) {
        var end   = args[2];
        var start = args[1];

        var s = start.getEmbeddedInteger() - 1;
        var e = end.getEmbeddedInteger();
        var string = args[0].getEmbeddedString();

        if (s < 0  ||  s >= string.length  ||  e > string.length  ||  e < s) {
            return universe.newString("Error - index out of bounds");
        } else {
            return universe.newString(string.substring(s, e));
        }
    }

{'fraction_non_alphanumeric': 0.12368024132730016, 'fraction_numerical': 0.012066365007541479, 'mean_word_length': 2.0992990654205608, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '960903', 'n_tokens_mistral': 818, 'n_tokens_neox': 775, 'n_words': 175}