Skip to content

Track the path of a file given a set of directory structure changes.

License

Notifications You must be signed in to change notification settings

rotundasoftware/path-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Solves for the new path of srcFilePath given the changes to the directory structure described by directoryChanges. directoryChanges is either a hash that maps the absolute paths of old directories to those of new directories or a function that does the same. srcFilePath is an absolute path.

If no changes are described in directoryChanges that affect the path of srcFilePath, then srcFilePath is returned.

pathMapper = require( 'path-mapper' );

dstFilePath = pathMapper( srcFilePath, directoryChanges );

// or

var url = pathMapper( srcFilePath, function( srcDir ) {
	return '/' + packagePathsToIds[ srcDir ];
} );

License

MIT

About

Track the path of a file given a set of directory structure changes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published