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: 411
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

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin