Skip to content
This repository has been archived by the owner. It is now read-only.
Computes the longest (compound) extension that is common to each path
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md

common-extname

Computes the longest (compound) extension that is common to each path. Tested with Node.js 0.10 and above.

Installation

npm install --save common-extname

Usage

The module has one default export, the commonExtname function:

var commonExtname = require('common-extname')

Call commonExtname() with an array of paths (strings):

var paths = ['main.html.handlebars', '_partial.html.handlebars']

commonExtname(paths) // returns '.html.handlebars'

An empty string is returned if no common extname exists:

commonExtname(['index.js', 'package.json']) // returns ''
You can’t perform that action at this time.