npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fipe-promise

v1.0.0

Published

Busca por dados de veiculos na tabela FIPE brasileira

Downloads

34

Readme

Instalação

Browser usando CDN

<script src="https://cdn.jsdelivr.net/npm/fipe-promise/dist/fipe-promise.min.js"></script>

npm

$ npm install --save fipe-promise

Bower

$ bower install --save deividfortuna/fipe-promise

yarn

$ yarn add fipe-promise

Uso

Consultar marcas

Para consultar as marcas disponíveis para um determinado tipo de veículo, utilize o método fetchBrands. O método recebe um parâmetro obrigatório: o tipo de veículo (carros, motos ou caminhões). Exemplo:

fipe
  .fetchBrands(fipe.vehicleType.CARS)
  .then((brands) => {
    // Faça algo com o array de marcas retornado
  })
  .catch((error) => {
    // Lide com o erro aqui
  });

Consultar modelos

Para consultar os modelos disponíveis para uma determinada marca, utilize o método fetchModels. O método recebe dois parâmetros obrigatórios: o tipo de veículo e o identificador da marca. Exemplo:

fipe
  .fetchModels(fipe.vehicleType.CARS, 21)
  .then((models) => {
    // Faça algo com o array de modelos retornado
  })
  .catch((error) => {
    // Lide com o erro aqui
  });

Consultar anos pelos modelos

Para consultar os anos pelos modelos disponíveis, utilize o método fetchYears. O método recebe três parâmetros obrigatórios: o tipo de veículo, o identificador da marca e o identificador do modelo. Exemplo:

fipe
  .fetchYears(fipe.vehicleType.CARS, 21, 4828)
  .then((years) => {
    // Faça algo com o array de anos/modelos retornado
  })
  .catch((error) => {
    // Lide com o erro aqui
  });

Consultar detalhes

Para consultar os detalhes de um determinado veículo (preço médio, código FIPE, marca, modelo e ano/modelo), utilize o método fetchDetail. O método recebe quatro parâmetros obrigatórios: o tipo de veículo, o identificador da marca, o identificador do modelo e o ano/modelo no formato "yyyy-X". Exemplo:

fipe
  .fetchDetail(fipe.vehicleType.CARS, 21, 4828, "2015-1")
  .then((detail) => {
    // Faça algo com o objeto de detalhes retornado
  })
  .catch((error) => {
    // Lide com o erro aqui
  });

Exemplo Angular 2+

import * as fipe from "fipe-promise";

fipe.fetchBrands(fipe.vehicleType.CARS).then(console.log);

Contribuição

Contribuições são sempre bem-vindas! Se você encontrar um bug ou tiver uma ideia para uma nova funcionalidade, fique à vontade para abrir uma issue ou enviar um pull request.

Licença

Este projeto é licenciado sob a MIT License.