Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

concrete-paths

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concrete-paths

An option-laden utility to takes general globs, delimited paths etc. and returns an array of absolute paths.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

concrete-paths

JavaScript Style Guide license

An option-laden utility which takes general glob-paths, delimited paths etc. and returns an array of absolute paths.

Install

$ npm install concrete-paths --save

Usages

Given a directory containing:

/stuff
  /lib
    file1.js
    file2.js
  /logs
    log1.txt
    log2.txt
  /node_modules
    /some-package1
      foo.txt
      bar.txt
    /some-package2
      foo.txt
      bar.txt
  /test    
    test1.js
    test2.js
    

Then concrete-paths can be used in the following ways:

Usage 1: Simple glob-pattern string usage

Please see the glob package's Glob Primer for more information with working with glob patterns.

const concretePaths = require('concrete-paths')

concretePaths('/stuff/**/*.js').then(
  function(result) {
    // Result:
    // [
    //   '/stuff/lib/file1.js',
    //   '/stuff/lib/file2.js',
    //   '/stuff/test/test1.js',
    //   '/stuff/test/test2.js'
    // ]
  }
)

Usage 2: Single ; delimited string

Useful when working with values derived from environment variables.

const concretePaths = require('concrete-paths')

concretePaths('/stuff/lib/*.js;/stuff/logs/*.js').then(
  function(result) {
    // Result:
    // [
    //   '/stuff/lib/file1.js',
    //   '/stuff/lib/file2.js',
    //   '/stuff/logs/log1.txt',
    //   '/stuff/logs/log2.txt'
    // ]
  }
)

Usage 3: Multiple strings via array

Mix-and-match delimited strings, globs etc. in an array of strings.

const concretePaths = require('concrete-paths')

concretePaths(
  [
    '/stuff/node_modules/some-package1/*',
    '/stuff/lib/*.js;/stuff/logs/*.js'
  ]  
).then(
  function(result) {
    // Result:
    // [
    //   '/stuff/node_modules/some-package1/foo.txt',
    //   '/stuff/node_modules/some-package1/bar.txt',
    //   '/stuff/lib/file1.js',
    //   '/stuff/lib/file2.js',
    //   '/stuff/logs/log1.txt',
    //   '/stuff/logs/log2.txt'
    // ]
  }
)

API

concretePaths(sourcePaths, [options]) returns promise

sourcePaths

options

OptionTypeNotes

Testing

$ npm test

License

MIT

Keywords

FAQs

Package last updated on 20 Mar 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc