Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-amd-module-type

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-amd-module-type - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

14

index.js

@@ -11,3 +11,3 @@ 'use strict';

* @param {Object|String} file - filename
* @param {Function} cb - Executed with (err, type)
* @param {Function} cb - Executed with (error, type)
*

@@ -26,4 +26,4 @@ * @example

fs.readFile(file, 'utf8', (err, data) => {
if (err) return cb(err);
fs.readFile(file, 'utf8', (error, data) => {
if (error) return cb(error);

@@ -85,9 +85,9 @@ let type;

*
* @param {String} filepath
* @param {String} file - filename
* @return {String|null}
*/
function sync(filepath) {
if (!filepath) throw new Error('filename missing');
function sync(file) {
if (!file) throw new Error('filename missing');
const source = fs.readFileSync(filepath, 'utf8');
const source = fs.readFileSync(file, 'utf8');

@@ -94,0 +94,0 @@ return fromSource(source);

{
"name": "get-amd-module-type",
"version": "3.0.1",
"description": "Get the type of AMD module used for an AST node or within a file",
"version": "3.0.2",
"description": "Get the type of an AMD module used for an AST node or within a file",
"main": "index.js",

@@ -6,0 +6,0 @@ "files": [

@@ -1,8 +0,10 @@

### get-amd-module-type [![CI](https://github.com/dependents/node-get-amd-module-type/actions/workflows/ci.yml/badge.svg)](https://github.com/dependents/node-get-amd-module-type/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/get-amd-module-type)](https://www.npmjs.com/package/get-amd-module-type) [![npm](https://img.shields.io/npm/dm/get-amd-module-type)](https://www.npmjs.com/package/get-amd-module-type)
# get-amd-module-type [![CI](https://img.shields.io/github/workflow/status/dependents/node-get-amd-module-type/CI/main?label=CI&logo=github)](https://github.com/dependents/node-get-amd-module-type/actions/workflows/ci.yml?query=branch%3Amain) [![npm version](https://img.shields.io/npm/v/get-amd-module-type)](https://www.npmjs.com/package/get-amd-module-type) [![npm downloads](https://img.shields.io/npm/dm/get-amd-module-type)](https://www.npmjs.com/package/get-amd-module-type)
> Get the type of AMD module used for an AST node or within a file
> Get the type of an AMD module used for an AST node or within a file
`npm install get-amd-module-type`
```sh
npm install get-amd-module-type
```
### Usage
## Usage

@@ -13,4 +15,5 @@ ```js

// Async
getType('my/file.js', (err, type) => {
getType('my/file.js', (error, type) => {
if (error) throw error;
console.log(type);
});

@@ -32,7 +35,7 @@

* 'named': `define('name', [deps], func)`
* 'deps': `define([deps], func)`
* 'rem': `define(function(require, exports, module){});`
* 'factory': `define(function(require){})`
* 'nodeps': `define({})`
* 'driver': `require([deps], function)`
* `'named'`: `define('name', [deps], func)`
* `'deps'`: `define([deps], func)`
* `'rem'`: `define(function(require, exports, module){});`
* `'factory'`: `define(function(require){})`
* `'nodeps'`: `define({})`
* `'driver'`: `require([deps], function)`
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