Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add merged array from arrays of paths generator #7

Open
richrdkng opened this issue Mar 29, 2020 · 0 comments
Open

feat: add merged array from arrays of paths generator #7

richrdkng opened this issue Mar 29, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@richrdkng
Copy link
Contributor

If path is called with an arrays of paths, return them as a merged array of processed paths.

Called with a Single Array

const path = require('@nodewell/path')

// called with a single array
const p = path(['@/', 'README.md'])

console.log(p) // ===>
/*
[
  'absolute/path/to/project/README.md'
]
*/

Called with Multiple Arrays

const path = require('@nodewell/path')

// called with a single array
const p = path(
  ['@/README.md'],
  ['@', '/src/**/*.*'],
)

console.log(p) // ===>
/*
[
  'absolute/path/to/project/README.md',
  'absolute/path/to/project/src/**/*.*'
]
*/

Called with Multiple Arrays Containing Path Suffix Arrays Including Glob Excludes

const path = require('@nodewell/path')

// called with a single array
const p = path([
'@src', [
  '/*.js',
  '/internals/*.js'
  ]
], [
'@/', [
  'README.md',
  'LICENSE.md',
  'package.json'
  ]
], [
'!@/package-lock.json'
], [
'@/', [
  '!.gitattributes',
  '!.gitignore'
  ]
])

console.log(p) // ===>
/*
[
  'absolute/path/to/project/src/*.js',
  'absolute/path/to/project/src/internals/*.js',
  'absolute/path/to/project/README.md',
  'absolute/path/to/project/LICENSE.md',
  'absolute/path/to/project/package.json,
  '!absolute/path/to/project/package-lock.json,
  '!absolute/path/to/project/.gitattributes,
  '!absolute/path/to/project/.gitigmore,
]
*/
@richrdkng richrdkng added the enhancement New feature or request label Mar 29, 2020
@richrdkng richrdkng added this to the 2.0.0 milestone Mar 29, 2020
@richrdkng richrdkng self-assigned this Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant