1
mirror of https://github.com/jakejarvis/npm-module-template.git synced 2025-04-26 06:25:23 -04:00

add README badges and usage section

This commit is contained in:
Jake Jarvis 2021-09-29 20:35:47 -04:00
parent 8d3f097e9c
commit c386d3b80f
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
3 changed files with 35 additions and 3 deletions

View File

@ -1,13 +1,33 @@
# Universal JS Boilerplate
[![CI](https://github.com/jakejarvis/npm-module-template/actions/workflows/ci.yml/badge.svg)](https://github.com/jakejarvis/npm-module-template/actions/workflows/ci.yml)
[![npm](https://img.shields.io/npm/v/@jakejarvis/my-module?logo=npm)](https://www.npmjs.com/package/@jakejarvis/my-module)
[![MIT License](https://img.shields.io/github/license/jakejarvis/npm-module-template?color=violet)](LICENSE)
Just a personal boilerplate to my liking for an Node and/or browser module w/ ESM, CommonJS, and UMD outputs via Babel & Rollup. Ready to publish on NPM and/or GitHub Packages and distibute via unpkg, skypack.dev, etc.
Probably not very useful to anybody else. 😊
## Usage
### something(options?)
#### options
Type: `object`
##### doSomething
Type: `boolean`\
Default: `false`
Makes it do something.
## Examples
- [dark-mode-switcheroo](https://github.com/jakejarvis/dark-mode)
- [simple-anchor](https://github.com/jakejarvis/simple-anchor)
- [get-canonical-url](https://github.com/jakejarvis/get-canonical-url)
## License

11
src/index.d.ts vendored
View File

@ -1,4 +1,13 @@
export interface Options {
/**
* Make it do something.
*
* @default false
*/
readonly doSomething?: boolean;
}
/**
* Does pretty much nothing, contrary to its name.
*/
export function something(): void;
export function something(options?: Options): void;

View File

@ -1,5 +1,8 @@
const something = function () {
console.info("well hello there");
const something = function (options) {
options = options || {};
if (options.doSomething) {
console.info("well hello there");
}
};
export { something };