forked from joepie91/icssify
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
481 B
JavaScript
24 lines
481 B
JavaScript
"use strict";
|
|
|
|
const through2 = require("through2");
|
|
|
|
const sortDependencies = require("../sort-dependencies");
|
|
const stream = require("../stream");
|
|
|
|
module.exports = function createKahnSortingStream() {
|
|
let sortables = [];
|
|
|
|
function handleItem(item) {
|
|
sortables.push(item);
|
|
}
|
|
|
|
function flush() {
|
|
let sorted = sortDependencies(sortables);
|
|
|
|
// TODO: Verify that the 'null' push here is necessary
|
|
return sorted.concat([ null ]);
|
|
}
|
|
|
|
return stream(handleItem, flush);
|
|
};
|