Socket
Socket
Sign inDemoInstall

any-path

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    any-path

make the keys on an object path.sep agnostic.


Version published
Weekly downloads
39
decreased by-86.36%
Maintainers
1
Install size
6.55 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 21 Dec 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc