
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
import-string
Advanced tools
This package allow us to import code from simple string, with support to:
This is a lightweight and simple package, you can install it using your favorite node package manager:
npm i import-string
pnpm add import-string
yarn add import-string
bun add import-string
In your file you can declare the module, functionality or variable in a string like the following example:
const stringSrc = `export const example = (): string => {
return {
foo: 'baz'
}
}`;
From the package you can import the importModule
function that receive string and returns the module:
import { importModule } from 'import-string';
async function main() {
const mod = await importModule(stringSrc);
console.log(mod.example().foo); // output -> baz
}
The importModule
function accepts an options object as its second parameter:
import { importModule } from 'import-string';
const mod = await importModule(stringSrc, {
target: 'es2018',
loader: 'ts',
});
pnpm install
Send a PR with the feat|fix|refactor
etc
1Bwo1Htd47rLRM4PZhydWtoC5ZAR4Fv9KZ
David Arenas 🇻🇪
This project is licensed under MIT
FAQs
Unknown package
The npm package import-string receives a total of 3,254 weekly downloads. As such, import-string popularity was classified as popular.
We found that import-string demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.