Socket
Socket
Sign inDemoInstall

interpret

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interpret

A dictionary of file extensions and associated module loaders.


Version published
Weekly downloads
18M
increased by2.68%
Maintainers
1
Weekly downloads
 
Created

Package description

What is interpret?

The interpret npm package is designed to be a dictionary of require extensions and associated file extensions. It allows developers to automatically register the appropriate require extension for files based on their file extensions. This is particularly useful when working with different types of files that need to be required in Node.js applications, such as .coffee, .ts, or .jsx files.

What are interpret's main functionalities?

Registering require extensions

This code retrieves the require extension for TypeScript files, allowing Node.js to understand how to process and import .ts files.

require('interpret').extensions['.ts']

Associating file extensions with custom handlers

This code demonstrates how to associate a custom file extension (.custom) with a custom compiler or handler to be used when requiring files with that extension.

var interpret = require('interpret');
var extensions = interpret.extensions;
extensions['.custom'] = require('my-custom-compiler');

Other packages similar to interpret

Readme

Source

interpret

A dictionary of file extensions and associated module loaders.

NPM

What is it

This is used by rechoir for registering module loaders.

API

extensions

Map file types to modules which provide a require.extensions loader.

{
  '.co': 'coco',
  '.coffee': 'coffee-script/register',
  '.csv': 'require-csv',
  '.iced': 'iced-coffee-script/register',
  '.ini': 'require-ini',
  '.js': null,
  '.json': null,
  '.litcoffee': 'coffee-script/register',
  '.ls': 'livescript',
  '.toml': 'toml-require',
  '.xml': 'require-xml',
  '.yaml': 'require-yaml',
  '.yml': 'require-yaml'
}

register

Check here to see if setup is needed for the module register itself with require.extensions. If a method is returned, call it with the module.

{
  'toml-require': function (module) {
    module.install();
  }
}

jsVariants

Extensions which are javascript variants.

{
  '.co': 'coco',
  '.coffee': 'coffee-script/register',
  '.js': null,
  '.litcoffee': 'coffee-script/register',
  '.ls': 'livescript'
}

Keywords

FAQs

Package last updated on 06 May 2014

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc