New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

common-dir

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-dir

Returns the parent directory common to each path

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

view on npm npm module downloads Gihub repo dependents Gihub package dependents Build Status js-standard-style

common-dir

commonDir(files) ⇒ string

Returns the parent directory common to each path.

Kind: Exported function
Returns: string - A single path ending with the path separator, e.g. '/user/some/folder/'

ParamTypeDescription
filesArrayAn array of file paths to inspect

Example

> const commonDir = require('common-dir')
> files = [
  '/Users/75lb/one/package.json',
  '/Users/75lb/one/test',
  '/Users/75lb/two/test/main.js'
]
> commonDir(files)
'/Users/75lb/'

© 2014-21 Lloyd Brookes 75pound@gmail.com. Documented by jsdoc-to-markdown.

Keywords

FAQs

Package last updated on 13 Mar 2021

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