Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Get the language associated with a file extension or the extensions associated with a language using the data from GitHub's [Linguist YAML file](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)
Get the language associated with a file extension or the extensions associated with a language using the data from GitHub's Linguist YAML file
The API changed in v0.4.0. Please see the documentation below for details on the new API. Don't hesitate to create an issue if you have any questions.
Install with npm
$ npm i lang-map --save
var map = require('lang-map');
Returns the language that is associated with the given file extension (with or without .
):
var map = require('lang-map');
map.languages('coffee');
//=> [ 'coffeescript' ]
map.languages('handlebars');
//=> [ 'handlebars' ]
map.languages('hbs');
//=> [ 'handlebars' ]
map.languages('javascript');
//=> [ 'javascript' ]
map.languages('js');
//=> [ 'javascript' ]
map.languages('md');
//=> [ 'markdown' ]
map.languages('mkdown');
//=> [ 'markdown' ]
Why is an array of languages returned?
In some (rare) cases an extension maps to multiple languages.
map.languages('h');
//=> [ 'c', 'c++', 'objective-c' ]
Returns the list of file extensions associated with the given language:
var map = require('lang-map');
map.extensions('coffee');
//=> [ 'coffee', '_coffee', 'cjsx', 'cson', 'iced' ]
map.extensions('hbs');
//=> [ 'handlebars', 'hbs' ]
map.extensions('markdown');
//=> [ 'md', 'markdown', 'mkd', 'mkdn', 'mkdown', 'ron' ]
map.extensions('md');
//=> [ 'md', 'markdown', 'mkd', 'mkdn', 'mkdown', 'ron' ]
map.extensions('c');
//=> [ 'c', 'cats', 'h', 'idc', 'w' ]
var map = require('lang-map');
var extensions = map().extensions;
var map = require('lang-map');
var languages = map().languages;
language-map: GitHub's Linguist YAML language map provided as JSON
Update the .json
language files in lib/.
$ npm run update
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 18, 2015.
FAQs
Get the language associated with a file extension or the extensions associated with a language using the data from GitHub's [Linguist YAML file](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)
The npm package lang-map receives a total of 5,422 weekly downloads. As such, lang-map popularity was classified as popular.
We found that lang-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.