Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    xspublic

    xs.js | Never Too Many Collections

    xs is a JavaScript library that lets you treat most everything like a collection that just does what you mean with via a unified, consistent interface.

    // Objects... 
    var o = xs({ a:1, b:2, c:3, 3:'d' });
    o.keys();
    // --> [ 'a', 'b', 'c', '3' ] 
    o.values();
    // --> [ 1, 2, 3, 'd' ] 
    o.attr(3);
    // --> 'd' 
     
    // Arrays... 
    var a = xs([ 1, 2, 3, 'd' ]);
    a.keys();
    // --> [ 0, 1, 2, 3 ] 
    a.values();
    // --> [ 1, 2, 3, 'd' ] 
    a.attr(3);
    // --> 'd' 
     
    var inc = function(x){ return x+1; };
    o.map(inc);
    // --> xs({ a:2, b:3, c:4, 3:'d1' }) 
    a.map(inc);
    // --> xs([ 2, 3, 4, 'd1' ]) 
     
     
    • Supports both Object-oriented and Functional styles.
    • Plays nice with other libraries (like jQuery).
    • Extensible via simple plugins.

    Keywords

    none

    install

    npm i xs

    Downloadsweekly downloads

    0

    version

    0.1.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar