any-path

1.3.0 • Public • Published

any-path

Build Status Coverage Status NPM version

For when the keys in an object represent paths, and you want to be able to fetch them regardless of your operating system's preference for path separators (\, /).

var assert = require('assert')
 
var ap = require('./')
var o = ap({
  './node_modules/any-path/package.json': {name: 'any-path'}
})
 
assert.equal(
  o['.\\node_modules\\any-path\\package.json'].name, 'any-path'
) // lookup works \o/
 
assert.equal(
  o['./node_modules/any-path/package.json'].name, 'any-path'
) // lookup works \o/
 
assert.equal(
  o['.\\node_modules/any-path\\package.json'].name, 'any-path'
) // lookup works \o/

API

__restore__

Put the object back into its initial state.

var o = anyPath({
  '.\\foo\\bar\\README.md': {name: 'README.md'}
})
o.__restore__().should.deep.equal({
  '.\\foo\\bar\\README.md': {name: 'README.md'}
})

License

ISC

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.0
    18
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.3.0
    18
  • 1.2.0
    0
  • 1.1.0
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i any-path

Weekly Downloads

18

Version

1.3.0

License

ISC

Last publish

Collaborators

  • bcoe