fliphub-resolve
0.0.12 • Public • Published 🎯 fliphub-resolve

📦 usage
yarn add fliphub-resolve
npm i fliphub-resolve --save
- if it's a monorepo package, it will default resolve relative to the monorepo root
- otherwise, it will default resolve relative to the the package root
- the root can be set once, and all other resolving using it will default to that root
- the root can be set for multiple scopes
const resolve = require('fliphub-resolve')
resolve('./path-from-root')
📘 examples
scope
const localResolver = resolve.scoped('local', __dirname)
const monoResolver = resolve.scoped('mono')
const appResolver = resolve.scoped('app').setRoot(1)
- a
number
can be passed for shorthand depth
obj
const obj = {
fixtures: './fixtures',
simple: './fixtures/somePath',
simplejs: './fixtures/somePath.js',
}
const resolvedObj = resolve.obj(obj)
arr
- resolves objects, arrays, with multiple scopes.
const arr = ['./fixtures', './fixtures/somePath']
const resolvedArr = resolver.arr(arr)
auto
const arr = ['./fixtures', './fixtures/somePath']
const obj = {
fixtures: './fixtures',
simple: './fixtures/somePath',
simplejs: './fixtures/somePath.js',
}
const resolvedArr = resolver(arr)
const resolvedObj = resolve(obj)
resolve-scoped
const apps = resolve.scope('app')('./eh.js')
const monos = resolve.scope('mono')('./eh.js')
const locals = resolve.scope('app')(arr)
Package Sidebar
Install
Weekly Downloads