0.1.4 • Published 10 years ago

mosaic-pathmapper v0.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 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

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

11 years ago

0.0.1

11 years ago