Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

autocosts

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autocosts

Automobile Costs Calculator

  • 6.3.13
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

autocosts – car costs calculator

Build Status Known Vulnerabilities Dependency Status js-standard-style npm npm module downloads

This calculator allows users to find the true cost of owning a car. It will normally give them a good estimate of what they really need to spend on car ownership. As car payments and expenses come due throughout the year, it's often difficult to really get a good understanding of total spending on a car. This calculator also provides to the user, optionally, the car's full Financial Effort considering the user's income, further providing also optionally the equivalent public transport costs (bus, train, UBER, etc.), considering the user doesn't own a car.

Try it on your machine

Install it and run it with the single command
npm i autocosts --production

it will open a http local server which you can access through http://localhost:3028

Website

https://autocosts.info

Playground

https://autocosts.info/XX

The list of available countries

https://autocosts.info/list

The translations are in corresponding json files, namely in the folder src/countries/.
The list of available countries is from the file src/countries/list.json

World statistics of Car Costs

https://autocosts.info/stats

How does it work?

Autocosts uses nodejs, expressjs and handlebarsjs to supply a server application that renders a car costs calculator as a webpage loaded by any common browser.

The project is optimized for a web-based version, and for an APP developped in Apache Cordova. The 2 last letters on the URI stands for the 2-letter ISO country code, and not for the language, since for example United Kingdom and Australia have the same language but different realities concerning the taxes, the terms applied to automobile costs and the units for fuel efficiency. The translations/language files apply therefore only to the selected country.

The project already considers all the units and fuel efficiency cases, different in many countries. The variations for fuel efficiency are l/100km, km/l, mpg(US), mpg(imp) and for distance are km, miles and mil (Nordic mile=10km). More information can be found in the directory src/countries/.

For more information regarding how the costs are calculated, you can check the src/client/core/ which is based on the 12 items that form the car costs for any given country. Namely they are:

  • Standing costs
    • Depreciation
    • Car taxes
    • Insurance
    • Inspection
    • Car finance
  • Running costs
    • Fuel
    • Maintenance
    • Repairs and Improvements
    • Parking
    • Tolls
    • Fines
    • Car washes

For more information see contributing.md

Aditional services

Autocosts supports the following additional services, which can be enabled or disabled (default). After building with node build.js, run node bin/server.js -h for more information.

Database

Autocosts also supports code such that the user inputs might be stored into a mysql database. With the data from said database, it is also possible to make several statisitcal analysis, namely the average costs for each country, said statistical analysis having outlier removal techniques, such that such outliers do not distort the average.

Uber

Autocosts may use the UBER API, such that at the final repport, the user calculations can be compared with the equivalents costs if the user would use just UBER or combined with public transports.

PDF

Autocosts also allows the final report to be printed into a PDF report. It makes use of pdfmake npm package.

Credentials file

The credentials for the above services are in the JSON files stored in credentials/

API

Install the api with the following command, ensuring that no scripts are run

npm i autocosts --ignore-scripts

Now use the autocosts api

const autocosts = require('autocosts')

// see https://github.com/jfoclpf/autocosts/blob/master/contributing.md#standards
// for standard units and time periods

var userData = {
  countryCode: 'US',
  currency: 'USD',

  depreciation: {
    dateOfAcquisition: {
      month: 5,
      year: 2001,
      valueOfTheVehicle: 25000
    },
    dateOfUserInput: {
      month: 2,
      year: 2020,
      valueOfTheVehicle: 5000
    }
  },

  insurance: {
    amountPerPeriod: 200,
    period: 'month'
  },

  credit: {
    creditBool: true,
    yesCredit: {
      borrowedAmount: 15000,
      numberInstallments: 48,
      amountInstallment: 350,
      residualValue: 0
    }
  },

  inspection: {
    averageInspectionCost: 120,
    numberOfInspections: 15
  },

  roadTaxes: {
    amountPerYear: 120
  },

  // Form Part 2
  fuel: {
    typeOfCalculation: 'distance', // type string: "money" or "distance"
    currencyBased: {
      amountPerPeriod: null,
      period: null // type string: "month", "twoMonths",  "trimester", "semester", "year"
    },
    distanceBased: {
      considerCarToJob: true, // boolean
      carToJob: {
        daysPerWeek: 5,
        distanceBetweenHomeAndJob: 15,
        distanceDuringWeekends: 30,
        distanceStandardUnit: 'mi' // standard distance for current country: "km", "mil" or "mil(10km)"
      },
      noCarToJob: {
        distancePerPeriod: null,
        period: null, // type string: "month", "twoMonths",  "trimester", "semester", "year"
        distanceStandardUnit: null // type string: "km", "mil" or "mil(10km)"
      },
      fuelEfficiency: 25, // fuel efficiency of the vehicle
      fuelEfficiencyStandard: 'mpg(US)', // type string; "ltr/100km", "mpg(US)", etc.
      fuelPrice: 2.5, // type number; currency per unit of volume standard. Ex: 1.4, that is 1.4 EUR / ltr
      fuelPriceVolumeStandard: 'gal(US)' // type string: 'ltr', 'gal(UK)', 'gal(US)'
    }
  },

  maintenance: {
    amountPerYear: 700
  },

  repairsImprovements: {
    amountPerYear: 200
  },

  parking: {
    amountPerMonth: 14
  },

  tolls: {
    calculationBasedOnDay: true, // true or false
    yesBasedOnDay: {
      amountPerDay: 2.5,
      daysPerMonth: 22
    },
    noBasedOnDay: {
      amountPerPeriod: null,
      period: null // type string: "month", "twoMonths",  "trimester", "semester", "year"
    }
  },

  fines: {
    amountPerPeriod: 40,
    period: 'year' // type string: "month", "twoMonths",  "trimester", "semester", "year"
  },

  washing: {
    amountPerPeriod: 110,
    period: 'year' // type string: "month", "twoMonths",  "trimester", "semester", "year"
  },
}

var results = autocosts.calculate(userData)
console.log(results)

The object results will be the following:

{
  "countryCode": "US",
  "currency": "USD",
  "costs": {
    "totalPerYear": 6595.880952380952,
    "totalEver": 123672.76785714286,
    "perMonth": {
      "items": {
        "depreciation": 88.88888888888889,
        "insurance": 200,
        "credit": 8,
        "inspection": 8,
        "roadTaxes": 10,
        "fuel": 78.26785714285715,
        "maintenance": 58.333333333333336,
        "repairsImprovements": 16.666666666666668,
        "parking": 14,
        "tolls": 55,
        "fines": 3.3333333333333335,
        "washing": 9.166666666666666
      },
      "standingCosts": 344.0555555555556,
      "runningCosts": 205.60119047619048,
      "total": 549.656746031746
    },
    "perUnitDistance": {}
  },
  "standardUnits": {
    "speed": "mi/h",
    "distance": "mi",
    "fuelEfficiency": "mpg(US)",
    "fuelPriceVolume": "gal(US)"
  }
}

The financial effort of the user and alternative costs considering public transports, uber and taxis included, are also optionally calculated. See the standard userData object for more information.

Android APP

The Android APP can be found in Play Store. It uses Apache Cordova to convert JavaScript built code into APP built files (for example APK files in Android)

License

GNU GPLv3

Privacy

This calculator is and shall always be completely anonymous, as it doesn't request nor permanently store, any name, email, cookies, IP address nor any other personal information.

Keywords

FAQs

Package last updated on 15 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc