Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

novemberborn/common-extname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 ''

About

Computes the longest (compound) extension that is common to each path

Resources

License

Stars

Watchers

Forks

Packages

No packages published