Skip to content
This repository was archived by the owner on Mar 16, 2020. It is now read-only.
/ to-file-path Public archive

!~!~( moved to `tunnckoCore/opensource` )~!~! Create a filepath from an object path (dot notation), list of arguments, array, number or Arguments object.

License

Notifications You must be signed in to change notification settings

tunnckoCore/to-file-path

Create a filepath from an object path (dot notation), list of arguments, array, number or Arguments object.

code climate standard code style travis build status coverage status dependency status

You might also be interested in ip-filter or to-object-path.

Install

npm i to-file-path --save

Usage

For more use-cases see the tests

const toFilePath = require('to-file-path')

Create filepath from different type of arguments.

Params

  • args {String|Array|Arguments|Number|Boolean}: Pass any type and any number of arguments.
  • returns {String}: always slash separated filepath

Example

var toFilePath = require('to-file-path')

console.log(toFilePath('foo.bar.baz')) // => 'foo/bar/baz'
console.log(toFilePath('foo.bar', 'qux.baz', 'xxx')) // => 'foo/bar/qux/baz/xxx'
console.log(toFilePath('foo', 'qux', 'baz')) // => 'foo/qux/baz'
console.log(toFilePath([1, 2, 3], 'foo', 4, 'bar')) // => '1/2/3/foo/4/bar'
console.log(toFilePath(null, true)) // => 'null/true'
console.log(toFilePath(1, 2, 3)) // => '1/2/3'

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github

About

!~!~( moved to `tunnckoCore/opensource` )~!~! Create a filepath from an object path (dot notation), list of arguments, array, number or Arguments object.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •