tyfon-conventions

TyFON conventions for mapping functions to endpoints

Usage no npm install needed!

<script type="module">
  import tyfonConventions from 'https://cdn.skypack.dev/tyfon-conventions';
</script>

README

tyfon-conventions

TyFON conventions for mapping functions to URL endpoints.

👉 Read this for more information.


Installation

npm i tyfon-conventions

Usage

👉 Find possible names from an invoked URL:

import { possibleNames } from 'tyfon-conventions';

console.log(possibleNames({
  method: 'POST',
  url: 'something'
});

// > something, postSomething, createSomething, addSomething

👉 Find URL and http method for a function name:

import { endpoint } from 'tyfon-conventions';

console.log(endpoint('postSomething'));

// > {
// >   method: 'POST',
// >   url: 'something'
// > }