<commit_before>var assert = require("assert");
var Lib = require("./../ramda");


describe("keys", function() {
    var keys = Lib.keys;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's own keys", function() {
        assert.deepEqual(keys(obj), ['a','b','c','d','e','f']);
    });

    it("should work with hasOwnProperty override", function() {
        assert.deepEqual(keys({
            "hasOwnProperty": false
        }), ["hasOwnProperty"]);
    });

    it("should work for primitives", function() {
        var result = Lib.map(function(val) {
            return Lib.keys(val);
        }, [null, undefined, 55, "", true, false, NaN, Infinity, , []]);
        assert.deepEqual(result, Lib.repeatN([], 10));
    });
    
    it("does not include the given object's prototype properties", function() {
        assert.deepEqual(keys(cobj), ['a', 'b']);
    });
});

describe("keysIn", function() {
    var keysIn = Lib.keysIn;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's keys", function() {
        assert.deepEqual(keysIn(obj), ['a','b','c','d','e','f']);
    });

    it("includes the given object's prototype properties", function() {
        assert.deepEqual(keysIn(cobj), ['a', 'b', 'x', 'y']);
    });
});


describe("values", function() {
    var values = Lib.values;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    var undef;
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's values", function() {
        assert.deepEqual(values(obj), [100,[1,2,3],{x: 200, y: 300},'D',null,undef]);
        assert.deepEqual(values({
            hasOwnProperty: false
        }), [false]);
    });

    it("does not include the given object's prototype properties", function() {
        assert.deepEqual(values(cobj), [100, 200]);
    });
});

describe("valuesIn", function() {
    var valuesIn = Lib.valuesIn;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's values", function() {
        assert.deepEqual(valuesIn(obj), [100,[1,2,3],{x: 200, y: 300},'D',null,undefined]);
    });
<commit_msg>valuesIn and keysIn should work for primitives<commit_after>var assert = require("assert");
var Lib = require("./../ramda");


describe("keys", function() {
    var keys = Lib.keys;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's own keys", function() {
        assert.deepEqual(keys(obj), ['a','b','c','d','e','f']);
    });

    it("should work with hasOwnProperty override", function() {
        assert.deepEqual(keys({
            "hasOwnProperty": false
        }), ["hasOwnProperty"]);
    });

    it("should work for primitives", function() {
        var result = Lib.map(function(val) {
            return Lib.keys(val);
        }, [null, undefined, 55, "", true, false, NaN, Infinity, , []]);
        assert.deepEqual(result, Lib.repeatN([], 10));
    });

    it("does not include the given object's prototype properties", function() {
        assert.deepEqual(keys(cobj), ['a', 'b']);
    });
});

describe("keysIn", function() {
    var keysIn = Lib.keysIn;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's keys", function() {
        assert.deepEqual(keysIn(obj), ['a','b','c','d','e','f']);
    });

    it("includes the given object's prototype properties", function() {
        assert.deepEqual(keysIn(cobj), ['a', 'b', 'x', 'y']);
    });

    it("should work for primitives", function() {
        var result = Lib.map(function(val) {
            return Lib.keys(val);
        }, [null, undefined, 55, "", true, false, NaN, Infinity, , []]);
        assert.deepEqual(result, Lib.repeatN([], 10));
    });
});


describe("values", function() {
    var values = Lib.values;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    var undef;
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's values", function() {
        assert.deepEqual(values(obj), [100,[1,2,3],{x: 200, y: 300},'D',null,undef]);
        assert.deepEqual(values({
            hasOwnProperty: false
        }), [false]);
    });

    it("does not include the given object's prototype properties", function() {
        assert.deepEqual(values(cobj), [100, 200]);
    });
    
    it("should work for primitives", function() {
        var result = Lib.map(function(val) {
            return Lib.keys(val);
        }, [null, undefined, 55, "", true, false, NaN, Infinity, , []]);
        assert.deepEqual(result, Lib.repeatN([], 10));
    });
});

describe("valuesIn", function() {
    var valuesIn = Lib.valuesIn;
    var obj = {a: 100, b: [1,2,3], c: { x: 200, y: 300}, d: "D", e: null, f: (function(){}())};
    function C() { this.a = 100; this.b = 200; }
    C.prototype.x = function() { return "x"; };
    C.prototype.y = "y";
    var cobj = new C();

    it("returns an array of the given object's values", function() {
        assert.deepEqual(valuesIn(obj), [100,[1,2,3],{x: 200, y: 300},'D',null,undefined]);
    });

{'fraction_non_alphanumeric': 0.2161739402471453, 'fraction_numerical': 0.03441263882371343, 'mean_word_length': 2.8541289933694998, 'pattern_counts': {'":': 2, '<': 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': '1740453', 'n_tokens_mistral': 2381, 'n_tokens_neox': 2159, 'n_words': 608}