Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@alheimsins/calculate-cheapest-charging-schedule
Advanced tools
Simple module for calculating the cheapest charging schedule for your EV
Simple module for calculating the cheapest charging schedule for your EV
import calculateCheapestChargingSchedule from '@alheimsins/calculate-cheapest-charging-schedule'
import priceArray from './data/pricelist.mjs'
const batteryCapacity = 38
const batteryCurrentLevel = 0.75
const chargingPower = 3.5
console.log(calculateCheapestChargingSchedule({ batteryCapacity, batteryCurrentLevel, chargingPower, priceArray }))
// returns ['2022-04-24T04:00:00.000+02:00', '2022-04-24T13:00:00.000+02:00', '2022-04-24T14:00:00.000+02:00']
The module expects an array of objects with the following properties as priceArray:
[
{
"startsAt": "2020-04-24T04:00:00.000+02:00",
"total": 0.5
},
{
"startsAt": "2020-04-24T13:00:00.000+02:00",
"total": 0.6
}
]
if your priceArray is not in this format you can supply a propertyMap
import calculateCheapestChargingSchedule from '@alheimsins/calculate-cheapest-charging-schedule'
const batteryCapacity = 38
const batteryCurrentLevel = 0.75
const chargingPower = 3.5
const priceArray = [
{
"starttid": "2020-04-24T04:00:00.000+02:00",
"pris": 0.5
},
{
"starttid": "2020-04-24T13:00:00.000+02:00",
"pris": 0.6
}
]
const propertyMap = {
startsAt: 'starttid',
total: 'pris'
}
console.log(calculateCheapestChargingSchedule({ batteryCapacity, batteryCurrentLevel, chargingPower, priceArray, propertyMap }))
// returns ['2022-04-24T04:00:00.000+02:00', '2022-04-24T13:00:00.000+02:00']
Created with ❤ for Alheimsins
FAQs
Simple module for calculating the cheapest charging schedule for your EV
The npm package @alheimsins/calculate-cheapest-charging-schedule receives a total of 10 weekly downloads. As such, @alheimsins/calculate-cheapest-charging-schedule popularity was classified as not popular.
We found that @alheimsins/calculate-cheapest-charging-schedule demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.