funkster-http-accepts
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

Using this module in other modules

Here is a quick example of how this module can be used in other modules. The TypeScript Module Resolution Logic makes it quite easy. The file src/index.ts acts as an aggregator of all the functionality in this module. It imports from other files and re-exports to provide a unified interface for this module. The package.json file contains main attribute that points to the generated lib/index.js file and typings attribute that points to the generated lib/index.d.ts file.

If you are planning to have code in multiple files (which is quite natural for a NodeJS module) that users can import, make sure you update src/index.ts file appropriately.

Now assuming you have published this amazing module to npm with the name my-amazing-lib, and installed it in the module in which you need it -

  • To use the Greeter class in a TypeScript file -
import { Greeter } from "my-amazing-lib";
 
const greeter = new Greeter("World!");
greeter.greet();
  • To use the Greeter class in a JavaScript file -
const Greeter = require('my-amazing-lib').Greeter;
 
const greeter = new Greeter('World!');
greeter.greet();

Package Sidebar

Install

npm i funkster-http-accepts

Weekly Downloads

0

Version

0.5.0

License

Unlicense

Last publish

Collaborators

  • bomret