# get-amd-module-type

> Get the type of an AMD module used for an AST node or within a file

Latest version **7.0.0** (published 2026-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-amd-module-type
pnpm add get-amd-module-type
yarn add get-amd-module-type
bun add get-amd-module-type
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-05-19 |
| First published | 2014-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 \|\| >=22.12.0 |
| Dependencies | 2 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Joel Kemp |
| Maintainers | pahen, mrjoelkemp, xhmikosr |
| Keywords | module, type, amd, factory, form |

## Links

- npm: https://www.npmjs.com/package/get-amd-module-type
- Repository: https://github.com/dependents/node-get-amd-module-type
- Issues: https://github.com/dependents/node-get-amd-module-type/issues
- npm.io page: https://npm.io/package/get-amd-module-type

## Dependencies (2)

- [ast-module-types](https://npm.io/package/ast-module-types.md) ^7.0.0
- [node-source-walk](https://npm.io/package/node-source-walk.md) ^8.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 7.0.0 (latest) — 2026-05-19
- 6.0.2 — 2026-04-13
- 6.0.1 — 2025-02-01
- 6.0.0 — 2024-04-14
- 5.0.1 — 2023-05-11
- 5.0.0 — 2023-05-04
- 4.1.0 — 2023-03-19
- 4.0.0 — 2022-03-03
- 3.0.2 — 2022-02-26
- 3.0.1 — 2022-02-26
- 3.0.0 — 2018-09-03
- 2.0.5 — 2016-09-05
- 2.0.4 — 2016-06-16
- 2.0.3 — 2015-02-28
- 2.0.2 — 2014-11-08
- … 3 more at https://npm.io/package/get-amd-module-type/versions

## README

# get-amd-module-type

[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-get-amd-module-type/ci.yml?branch=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?logo=npm&logoColor=fff)](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 an AMD module used for an AST node or within a file

```sh
npm install get-amd-module-type
```

## Usage

```js
// ESM
import getType from 'get-amd-module-type';
// or CJS
const getType = require('get-amd-module-type');

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

let type;

// Sync
type = getType.sync('my/file.js');

// From source code
type = getType.fromSource('define() {}');

// From an AST node
type = getType.fromAST(node);
```

The returned `type` will be any of the following:

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

[MIT](LICENSE)

---
_Source: https://npm.io/package/get-amd-module-type · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
