Render a reducible of sorted lists

npm install sorted-list
2 downloads in the last week
4 downloads in the last month


build status dependency status

browser support

Render a reducible of sorted lists


var SortedList = require("sorted-list")
var foldp = require("reducers/reductions")
var map = require("reducers/map")
var fold = require("reducers/fold")

// Accumulate a state representation of a list
var state = foldp(input, function (list, event) {
    if (event.type === "add") {
        return list.concat(event.value)
    return list

// make sure it's sorted! and that's it's a list of elements
var sorted = map(state, function (list) {
    return list.sort(function (a, b) {
        return a.timestamp < b.timestamp ? -1 : 1
    }).map(function (x) {
        return x.view

var container = document.getElementById("some-container")

// SortedList will ensure it's all in there correctly in
// order of your array
var list = SortedList(sorted, container)

// make sure to fold reducible somewhere!
fold(list, function () {})


npm install sorted-list


  • Raynos

MIT Licenced

npm loves you