Skip to content

Instantly share code, notes, and snippets.

View marshall's full-sized avatar

Marshall Culpepper marshall

View GitHub Profile
@marshall
marshall / compare.js
Created January 8, 2013 12:37
Services.vc.compare for different version strings
Components.utils.import("resource://gre/modules/Services.jsm");
let versions = [
"1.0", "1.0.0", "1.0.0beta", "1.0.0.1", "1.0.20", "1.0.2.0", "1.1.0.1",
"1.1.0", "1.1.0alpha"
];
versions.sort(Services.vc.compare);
versions.reverse();
for (let i = 0; i < versions.length; i++) {