diff options
author | isaacs <i@izs.me> | 2010-05-13 01:59:29 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-13 01:59:29 +0400 |
commit | 5f4e1c48614e42e47e46a375d09a822ea6744a11 (patch) | |
tree | 9d3d2bcb4a994eab6f6508dffdaa03aad55bcc3c /lib | |
parent | e4072e569d1c30bf61d0dfbf5ed5b7834de2a604 (diff) |
show data in version order
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ls.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -7,6 +7,7 @@ var npm = require("../npm") , log = require("./utils/log") , readInstalled = require("./utils/read-installed") , registry = require("./utils/registry") + , semver = require("./utils/semver") function ls (args, cb) { readInstalled([], function (er, installed) { @@ -28,7 +29,7 @@ function prettify (data) { , maxNameLen = 0 pkgs.forEach(function (name) { var pkg = data[name] - for (var v in pkg) { + Object.keys(pkg).sort(semver.compare).forEach(function (v) { var ver = pkg[v] , p = [] ver.tags = ver.tags.length === 0 @@ -40,7 +41,7 @@ function prettify (data) { names.push(name + "@" + v) maxNameLen = Math.max(maxNameLen, (name + "@" + v).length) attrs.push(p.sort(strcmp).join(" ")) - } + }) }) var space = " " for (var n = 0, l = names.length; n < l; n ++) { |