steal-fuzzy-normalize is a module that tries its hardest to normalize a module identifier given the normal steal rules. It's imperfect, but if you give it a list of possible matches it might just work.
npm install steal-fuzzy-normalize --save
Getting a match from an array.
var normalize = require("steal-fuzzy-normalize");
var possibilities = [
"[email protected]#home/home",
"[email protected]#orders/orders",
"[email protected]#cart/cart"
];
var match = normalize("orders/", possibilities);
assert.equal(match, "[email protected]#orders/orders"); // Works
Getting a match from an object. This allows you to get metadata for a particular match (useful for bundle manifests).
var normalize = require("steal-fuzzy-normalize");
var possibilities = {
"[email protected]#home/home": {page:"home"},
"[email protected]#orders/orders": {page:"orders"},
"[email protected]#cart/cart": {page:"cart"}
};
var match = normalize("orders/", possibilities);
assert.equal(match.page, "orders"); // Works