# import-by

> Import a module using a string reference

Latest version **1.0.4** (published 2021-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install import-by
pnpm add import-by
yarn add import-by
bun add import-by
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-03-14 |
| First published | 2021-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Giao Ho |
| Maintainers | jout |
| Keywords | import, module, string-ref, parent-dirname |

## Links

- npm: https://www.npmjs.com/package/import-by
- Repository: https://github.com/joutvhu/import-by
- Homepage: https://github.com/joutvhu/import-by#readme
- Issues: https://github.com/joutvhu/import-by/issues
- npm.io page: https://npm.io/package/import-by

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-03-14
- 1.0.3 — 2021-03-13
- 1.0.2 — 2021-03-13

## README

# import-by

Import a module using a string reference

## Installation

```shell
npm i import-by
# or
yarn add import-by
```

## Usage

See the following example to understand how to use it

```js
// detail.js
module.exports.beverage = {
    id: 12,
    name: 'coffee'
};
```

```js
const {importBy} = require('import-by');

const beverage = importBy('./detail#beverage');

const beverageName = importBy('./detail#beverage.name', __dirname);
```

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