0.1.4 • Published 8 years ago

mosaic-pathmapper v0.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

# mosaic-pathmapper

This module allows to find objects and parameters by paths. User associates path masks with objects.

Example (see the './examples' folder):

    import { PathMapper } from '../';
    let mapper = new PathMapper();
    let projectHandler = function(params){
        console.log('- Project Name: ', params.projectName);
        console.log('- Project Path: ', params.path);
    }
    mapper.add('/project/:projectName/*path', projectHandler);
    let result = mapper.find('/project/FooBar/path/to/my/doc.pdf');
    console.log('Result : ', result);
    /* 
     * The result should be:
     * { 
     *   params: { projectName: 'FooBar', path: 'path/to/my/doc.pdf' }, 
     *   obj: [Function: projectHandler]
     * }
    */
    result.obj(result.params);
    /*
     * The projectHandler method should write the following text in the console:
     * - Project Name: FooBar
     * - Project Path: path/to/my/doc.pdf
     */
0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago