Code Monkey home page Code Monkey logo

alamid-list's People

Contributors

jhnns avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

alamid-list's Issues

Add underscore plugin

Would be nice to use alamid-list with underscore-functions

var list = require("alamid-list");

list.use(require("alamid-list/plugins/underscore"),
    { underscore: require("underscore") });
list.pluck("name"); // ["moe", "larry", "curly"]

Should be patchable on raw array

If I don't want to wrap an array (because I just want to expose an array instead of an instance of alamid-list), it would be useful to just override the array methods:

List.patch(arr);

arr.on("add", function () {})

Add pointer plugin

It would be cool to create a pointer which updates itself when elements are being added:

var list = new List([1,2,3])
var pointer = list.pointer(1);

pointer(); // 1, equals the given index
list.unshift(0); // [0, 1, 2, 3]
pointer(); // 2, equals the new index, because an element has been added
list.push(4); // [0, 1, 2, 3, 4]
pointer(); // 2, because an element has been appended which doesn't affect the pointer
list.push(5); // [0, 1, 2, 3, 4, 5]
list.reverse(); // [5, 4, 3, 2, 1, 0]
pointer(); // 3, because the order has been changed
list.splice(3, 1); // [5, 4, 3, 1, 0]
pointer(); // 3, because the pointer is not connected to the element it points to

But what happens on sort()? Probably the best solution is to retrieve the element where the pointer points to and then, after sort() use indexOf() to determine where the element was placed.

Add unique-plugin

It would be nice to make a list unique. In order to accomplish this the plugin needs to iterate the array to look for the element. The plugin should recognize a sorted list and use an optimized algorithm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.