"piment",
"poolifier",
"preinstall",
+ "rambda",
"Recurrency",
"RFID",
"shutdowning",
'chalk',
'date-fns',
'http-status-codes',
- 'lodash-es',
'logform',
'mnemonist',
'mongodb',
'node:*',
'poolifier',
+ 'rambda',
'tar',
'winston',
'winston/*',
"chalk": "^5.3.0",
"date-fns": "^3.3.1",
"http-status-codes": "^2.3.0",
- "lodash-es": "^4.17.21",
"logform": "^2.6.0",
"mnemonist": "0.40.0-rc1",
"mongodb": "^6.3.0",
"poolifier": "^3.1.20",
+ "rambda": "^9.1.0",
"tar": "^6.2.0",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^5.0.0",
"@commitlint/config-conventional": "^18.6.0",
"@mikro-orm/cli": "^6.1.3",
"@release-it/bumper": "^6.0.1",
- "@types/lodash-es": "^4.17.12",
"@types/node": "^20.11.17",
"@types/tar": "^6.1.11",
"@types/ws": "^8.5.10",
http-status-codes:
specifier: ^2.3.0
version: 2.3.0
- lodash-es:
- specifier: ^4.17.21
- version: 4.17.21
logform:
specifier: ^2.6.0
version: 2.6.0
poolifier:
specifier: ^3.1.20
version: 3.1.20
+ rambda:
+ specifier: ^9.1.0
+ version: 9.1.0
tar:
specifier: ^6.2.0
version: 6.2.0
'@release-it/bumper':
specifier: ^6.0.1
version: 6.0.1(release-it@17.0.3)
- '@types/lodash-es':
- specifier: ^4.17.12
- version: 4.17.12
'@types/node':
specifier: ^20.11.17
version: 20.11.17
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
dev: true
- /@types/lodash-es@4.17.12:
- resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
- dependencies:
- '@types/lodash': 4.14.202
- dev: true
-
- /@types/lodash@4.14.202:
- resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==}
- dev: true
-
/@types/long@4.0.2:
resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==}
dev: true
/lodash-es@4.17.21:
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
+ dev: true
/lodash.camelcase@4.3.0:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
through2: 2.0.5
dev: true
+ /rambda@9.1.0:
+ resolution: {integrity: sha512-fCRAq8Of+bAuqjAA0MSb/umbNgiYwy9N5camM2T++Qu/mRImLT3a31hf0REvnqaWCrgrdC3ewf/ucAILsYeBgQ==}
+ dev: false
+
/randombytes@2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
dependencies:
import { parentPort } from 'node:worker_threads'
import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns'
-import { merge } from 'lodash-es'
+import { mergeDeepRight } from 'rambda'
import { type RawData, WebSocket } from 'ws'
import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
} does not match firmware version pattern '${stationInfo.firmwareVersionPattern}'`
)
}
- stationInfo.firmwareUpgrade = merge(
+ stationInfo.firmwareUpgrade = mergeDeepRight(
{
versionUpgrade: {
step: 1
} else {
delete configurationData.configurationKey
}
- configurationData = merge(
+ configurationData = mergeDeepRight(
configurationData,
buildChargingStationAutomaticTransactionGeneratorConfiguration(this)
)
import { fileURLToPath } from 'node:url'
import chalk from 'chalk'
-import { merge } from 'lodash-es'
+import { mergeDeepRight } from 'rambda'
import {
buildPerformanceUriFilePath,
}
}
if (hasOwnProp(Configuration.getConfigurationData(), ConfigurationSection.uiServer)) {
- uiServerConfiguration = merge(
+ uiServerConfiguration = mergeDeepRight(
uiServerConfiguration,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Configuration.getConfigurationData()!.uiServer!
minutesToSeconds,
secondsToMilliseconds
} from 'date-fns'
+import { clone as cloneDeep } from 'rambda'
import { Constants } from './Constants.js'
import {
return timeSeries.map(timeSeriesItem => timeSeriesItem.value)
}
-type CloneableData =
- | number
- | string
- | boolean
- | null
- | undefined
- | Date
- | CloneableData[]
- | { [key: string]: CloneableData }
-
-type FormatKey = (key: string) => string
-
-const deepClone = <I extends CloneableData, O extends CloneableData = I>(
- value: I,
- formatKey?: FormatKey,
- refs: Map<I, O> = new Map<I, O>()
-): O => {
- const ref = refs.get(value)
- if (ref !== undefined) {
- return ref
- }
- if (Array.isArray(value)) {
- const clone: CloneableData[] = []
- refs.set(value, clone as O)
- for (let i = 0; i < value.length; i++) {
- clone[i] = deepClone(value[i], formatKey, refs)
- }
- return clone as O
- }
- if (value instanceof Date) {
- return new Date(value.getTime()) as O
- }
- if (typeof value !== 'object' || value === null) {
- return value as unknown as O
- }
- const clone: Record<string, CloneableData> = {}
- refs.set(value, clone as O)
- for (const key of Object.keys(value)) {
- clone[typeof formatKey === 'function' ? formatKey(key) : key] = deepClone(
- value[key],
- formatKey,
- refs
- )
- }
- return clone as O
-}
-
export const clone = <T>(object: T): T => {
- return deepClone(object as CloneableData) as T
+ return cloneDeep(object)
}
/**
expect(clone(map)).toStrictEqual({})
const set = new Set(['1'])
expect(clone(set)).toStrictEqual({})
- // The URL object seems to have not enumerable properties
- const url = new URL('https://domain.tld')
- expect(clone(url)).toStrictEqual({})
const weakMap = new WeakMap([[{ 1: 1 }, { 2: 2 }]])
expect(clone(weakMap)).toStrictEqual({})
const weakSet = new WeakSet([{ 1: 1 }, { 2: 2 }])