New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

relative-path-map

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relative-path-map

Configure a map of paths that may refer to each other

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
14
27.27%
Maintainers
1
Weekly downloads
 
Created
Source

relative-path-map

Version License Build Coverage Dependencies

Resolves a map of paths where some paths are relative to others in the same object. Useful for describing directory structures and for project configuration.

Install

Install via npm:

npm install --save-dev relative-path-map

Examples

Simple example

var relativePathMap = require('relative-path-map');

relativePathMap({
  root: 'root/path',
  sub: '[root]/sub' // => 'root/path/sub'
});

Sub-object with relative paths

relativePathMap({
  root: 'root/path',
  obj: {
    sub: '[root]/sub', // => 'root/path/sub'
    file: '[sub]/file.js' // => 'root/path/sub/file.js'
  }
});

Array with relative paths

relativePathMap({
  root: 'root/path',
  arr: [
    '[root]/sub', // => 'root/path/sub'
    '[0]/file.js' // => 'root/path/sub/file.js'
  ]
});

Placeholder with sub-property

relativePathMap({
  obj: {
    sub: 'some/path',
  },
  dot: '[obj.sub]/dot-notation.js' // => // 'some/path/dot-notation.js'
});

API

relativePathMap(map)

Params

map object

An object containing strings representing paths. Paths beginning with a placeholder [<prop>] are relative to some other path in the same object, where <prop> is a property name, e.g. [root], or a sub-property name, e.g [root.src].

Returns

Type: object

Returns an object whose relative paths have been resolved.

License

Copyright © 2016 Akim McMath. Licensed under the MIT License.

Keywords

path

FAQs

Package last updated on 08 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts