cep-any
TypeScript icon, indicating that this package has built-in type declarations

4.1.3 • Public • Published

cep-any

build version

A low dependency CEP lib

WARNING

if you use node.js 15 or lower, see 1.3.0 version, 2.0.0 version breaking changes because fetch native has been in use

Simple use

const {cep} = require("cep-any");

cep("41342315").them(console.log);
import {cep} from "cep-any";

Using factory and create a custonservice

const { factory, CepService , Requester} = require("cep-any");

class NewService extends CepService {
	// Requester is a http client using fetch api, but you shuld be replace for another lib
	constructor() {
		super('custonapi', Requester)
	}
	handler = async (cep) => {
		return {
			cep: "88888888",
			city: "something",
			neighborhood: "something",
			street: "something",
			state: "AB",
		};
	};
}
const instanceService = new NewService("newService");
const handler = factory({
	useDefaultProviders: false,
	custonProviders: [instanceService],
});

handler.execute("41342315").them(console.log);

Package Sidebar

Install

npm i cep-any

Weekly Downloads

35

Version

4.1.3

License

MIT

Unpacked Size

21.5 kB

Total Files

7

Last publish

Collaborators

  • victorfernandesraton