Skip to content

Try to normalize a module identifier given a set of possible module names. Match to the closest result possible.

Notifications You must be signed in to change notification settings

stealjs/steal-fuzzy-normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

steal-fuzzy-normalize

Build Status npm version Greenkeeper badge

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.

Install

npm install steal-fuzzy-normalize --save

Examples

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

About

Try to normalize a module identifier given a set of possible module names. Match to the closest result possible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published