Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
move 'sort' to the object, not the props
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 27, 2012
1 parent d175163 commit b6f3dd3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/dir-reader.js
Expand Up @@ -30,6 +30,10 @@ function DirReader (props) {
me._paused = false me._paused = false
me._length = -1 me._length = -1


if (props.sort) {
this.sort = props.sort
}

Reader.call(this, props) Reader.call(this, props)
} }


Expand All @@ -46,9 +50,8 @@ DirReader.prototype._getEntries = function () {


function processEntries () { function processEntries () {
me._length = me.entries.length me._length = me.entries.length
// console.error("DR %s sort =", me.path, me.props.sort) if (typeof me.sort === "function") {
if (typeof me.props.sort === "function") { me.entries = me.entries.sort(me.sort.bind(me))
me.entries.sort(me.props.sort)
} }
me._read() me._read()
} }
Expand Down

0 comments on commit b6f3dd3

Please sign in to comment.