get-amd-module-type
Advanced tools
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)` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5483
40
0