1.0.9 • Published 4 years ago

pathfindr v1.0.9

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

pathfindr

safely traverse objects or arrays without breaking your application.

pathfindr(path: string, model: any, fallbackValue?: any) : result | fallbackValue

Example

const data = {
    users: {
        images: [
            {
                url: '/image.png'
            }
        ]
    }
};
const result = pathfindr('users/images/0/url', data); // => /image.png

This will not break the application

const data = {};
const result = pathfindr('data/images/0/url', data); // => null

This will not break the application and set fallback value

const data = {};
const result = pathfindr('data/images/0/url', data, '/fallback.png'); // => /fallback.png
1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago