A low dependency CEP lib
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
const {cep} = require("cep-any");
cep("41342315").them(console.log);
import {cep} from "cep-any";
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);