1. any-path
make the keys on an object path.sep agnostic.
any-path
Package: any-path
Created by: bcoe
Last modified: Mon, 13 Jun 2022 03:07:18 GMT
Version: 1.3.0
License: ISC
Downloads: 80
Repository: https://github.com/bcoe/any-path

Install

npm install any-path
yarn add any-path

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code