diff --git a/.stylelintrc.json b/.stylelintrc.json index 40034ec..b662cfc 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -4,7 +4,11 @@ "stylelint-config-standard-scss", "stylelint-config-recommended-vue/scss" ], - "ignoreFiles": ["**/static-ui/dist/*", "**/ati-smarttag.js", "**/skycons.js"], + "ignoreFiles": [ + "**/static-ui/dist/*", + "**/ati-smarttag.js", + "**/skycons.js" + ], "rules": { "declaration-empty-line-before": null, "indentation": "tab", diff --git a/eslint.config.mjs b/eslint.config.mjs index f337073..1283bd7 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -30,6 +30,8 @@ export default audiolab( // a bit more complex to fix (but nice idea in general) 'import/no-default-export': 'off', 'no-console': 'off', + 'func-names': 'off', + 'jsonc/sort-keys': 'off', // harder to fix }, diff --git a/package.json b/package.json index 58b21f3..47e40a4 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,7 @@ "url": "https://github.com/swrlab/node-utils" }, "author": "SWR Audio Lab ", - "engines": { - "node": ">=20" - }, + "license": "MIT", "main": "./index.js", "scripts": { "ard:coreId": "node ./scripts/ard/coreId.js", @@ -21,7 +19,6 @@ "outdated": "yarn upgrade-interactive", "reinstall": "rm -rf node_modules && rm yarn.lock && touch yarn.lock && yarn" }, - "license": "MIT", "dependencies": { "@google-cloud/storage": "^7.11.3", "abort-controller": "^3.0.0", @@ -38,6 +35,9 @@ "mocha": "^10.6.0", "prettier": "^3.3.2" }, + "engines": { + "node": ">=20" + }, "packageManager": "yarn@4.2.2", "prettier": "@swrlab/style-guide/prettier" } diff --git a/packages/storage-wrapper/load.js b/packages/storage-wrapper/load.js index bb13394..96645d6 100644 --- a/packages/storage-wrapper/load.js +++ b/packages/storage-wrapper/load.js @@ -23,7 +23,10 @@ module.exports = async function (uri, _logPrefix, options) { const path = structure.join('/') // load file - const file = await this.sdk.gs.bucket(bucket).file(path).download() + const file = await this.sdk.gs + .bucket(bucket) + .file(path) + .download() // return file return Promise.resolve(file[0]) @@ -45,7 +48,9 @@ module.exports = async function (uri, _logPrefix, options) { } return Promise.reject( - new Error(`fetching url failed with status > ${file.statusCode}`) + new Error( + `fetching url failed with status > ${file.statusCode}` + ) ) } diff --git a/packages/storage-wrapper/move.js b/packages/storage-wrapper/move.js index 69e2192..345b3a9 100644 --- a/packages/storage-wrapper/move.js +++ b/packages/storage-wrapper/move.js @@ -19,10 +19,16 @@ module.exports = async function (sourceUri, destinationUri, keepOriginal) { // move file within gcs if (keepOriginal !== true) { // move file - await this.sdk.gs.bucket(bucket).file(path).move(destinationUri) + await this.sdk.gs + .bucket(bucket) + .file(path) + .move(destinationUri) } else { // copy file - await this.sdk.gs.bucket(bucket).file(path).copy(destinationUri) + await this.sdk.gs + .bucket(bucket) + .file(path) + .copy(destinationUri) } // return ok diff --git a/packages/storage-wrapper/save.js b/packages/storage-wrapper/save.js index a9598c8..a3b2ef9 100644 --- a/packages/storage-wrapper/save.js +++ b/packages/storage-wrapper/save.js @@ -26,9 +26,7 @@ const deleteLocalFile = (that, filePath) => }) module.exports = async function (uri, buffer, _logPrefix, resumable) { - let structure - let bucket - let path + let structure, bucket, path if (uri.substr(0, 5).toLowerCase() === 'gs://') { // google cloud storage @@ -53,7 +51,9 @@ module.exports = async function (uri, buffer, _logPrefix, resumable) { } // upload file to gcs - await this.sdk.gs.bucket(bucket).upload(tempFilePath, bucketConfig) + await this.sdk.gs + .bucket(bucket) + .upload(tempFilePath, bucketConfig) // delete local temp file await deleteLocalFile(this, tempFilePath) diff --git a/packages/undici/request.js b/packages/undici/request.js index 13ad419..4a0b5a6 100644 --- a/packages/undici/request.js +++ b/packages/undici/request.js @@ -1,5 +1,3 @@ -/* eslint-disable prefer-promise-reject-errors */ - // load node utils const undici = require('undici') const AbortController = require('abort-controller') @@ -19,7 +17,8 @@ module.exports = async (url, options) => { // calculcate redirect const maxRedirections = - options?.maxRedirections !== null && options?.maxRedirections !== undefined + options?.maxRedirections !== null && + options?.maxRedirections !== undefined ? options.maxRedirections : 5 @@ -31,24 +30,34 @@ module.exports = async (url, options) => { signal: abortController.signal, maxRedirections, } - if (options?.headers) requestOptions.headers = { ...requestOptions.headers, ...options.headers } + if (options?.headers) + requestOptions.headers = { + ...requestOptions.headers, + ...options.headers, + } // make actual request - const { statusCode, headers, trailers, body } = await undici.request(url, requestOptions) + const { statusCode, headers, trailers, body } = await undici.request( + url, + requestOptions + ) // remove timeout since request finished beforehand clearTimeout(abortTimeout) // set ok const ok = statusCode >= 200 && statusCode < 300 - if (!ok && (!options || options?.reject !== false)) return Promise.reject({ statusCode, ok, headers, url }) + if (!ok && (!options || options?.reject !== false)) + return Promise.reject({ statusCode, ok, headers, url }) // turn stream into string const { string, buffer } = await convertReadableStream(body) // detect/ set redirect const redirect = - statusCode >= 300 && statusCode < 400 && headers.location ? new URL(headers.location, url) : null + statusCode >= 300 && statusCode < 400 && headers.location + ? new URL(headers.location, url) + : null // fetch header vars const contentType = headers['content-type'] @@ -56,7 +65,11 @@ module.exports = async (url, options) => { // parse json if set let json try { - json = contentType?.indexOf('application/json') !== -1 ? JSON.parse(string) : null + json = + contentType?.indexOf('application/json') !== -1 + ? JSON.parse(string) + : null + // eslint-disable-next-line no-unused-vars } catch (error) { json = null } diff --git a/scripts/ard/categories.js b/scripts/ard/categories.js index 9dd23f6..033dc16 100644 --- a/scripts/ard/categories.js +++ b/scripts/ard/categories.js @@ -21,10 +21,14 @@ const crawl = async () => { const remapItem = (item) => { // remap children if available - const children = item.children ? item.children.map(remapItem) : null + const children = item.children + ? item.children.map(remapItem) + : null // set main or sub prefix - const prefix = item.children ? CORE_PREFIX_GENRE : CORE_PREFIX_SUBGENRE + const prefix = item.children + ? CORE_PREFIX_GENRE + : CORE_PREFIX_SUBGENRE // build item const category = { @@ -45,7 +49,10 @@ const crawl = async () => { const tree = categories.map(remapItem) - await storage.save('data/ard/categories.json', JSON.stringify({ tree, list }, null, '\t')) + await storage.save( + 'data/ard/categories.json', + JSON.stringify({ tree, list }, null, '\t') + ) } crawl() diff --git a/scripts/ard/publishers.js b/scripts/ard/publishers.js index 28ec759..068ed9f 100644 --- a/scripts/ard/publishers.js +++ b/scripts/ard/publishers.js @@ -17,29 +17,44 @@ const storage = new Storage({ logging: true, }) -const ARD_API_URL = process.env.ARD_DELIVER_API || 'https://deliver-test.ard.de/organization-service/' -const ARD_API_HEADERS = { Authorization: `Basic ${Buffer.from(process.env.ARD_AUTH).toString('base64')}` } +const ARD_API_URL = + process.env.ARD_DELIVER_API || + 'https://deliver-test.ard.de/organization-service/' +const ARD_API_HEADERS = { + Authorization: `Basic ${Buffer.from(process.env.ARD_AUTH).toString('base64')}`, +} const crawl = async () => { const output = [] try { - const { string: publisherString } = await undici(`${ARD_API_URL}publishers?page=0&size=500`, { - headers: ARD_API_HEADERS, - }) + const { string: publisherString } = await undici( + `${ARD_API_URL}publishers?page=0&size=500`, + { + headers: ARD_API_HEADERS, + } + ) const publishers = JSON.parse(publisherString) for await (const publisher of publishers.elements) { - const { string: publisherInfoString } = await undici(publisher.href, { - headers: ARD_API_HEADERS, - }) + const { string: publisherInfoString } = await undici( + publisher.href, + { + headers: ARD_API_HEADERS, + } + ) const publisherInfo = JSON.parse(publisherInfoString) - const { string: institutionInfoString } = await undici(publisherInfo.institution.href, { - headers: ARD_API_HEADERS, - }) - const institutionInfo = JSON.parse(institutionInfoString) + const { string: institutionInfoString } = await undici( + publisherInfo.institution.href, + { + headers: ARD_API_HEADERS, + } + ) + const institutionInfo = JSON.parse( + institutionInfoString + ) const details = { _type: publisherInfo._type, @@ -59,7 +74,10 @@ const crawl = async () => { console.log(details) } - await storage.save('tmp/ard-publishers.json', JSON.stringify(output)) + await storage.save( + 'tmp/ard-publishers.json', + JSON.stringify(output) + ) } catch (error) { console.log(error) } diff --git a/scripts/ard/sortPubByExtId.js b/scripts/ard/sortPubByExtId.js index 40ce30c..054dd55 100644 --- a/scripts/ard/sortPubByExtId.js +++ b/scripts/ard/sortPubByExtId.js @@ -20,10 +20,16 @@ const sort = async () => { const publisher = JSON.parse(input) publisher.sort((a, b) => { - return parseInt(a.externalId) - parseInt(b.externalId) + return ( + Number.parseInt(a.externalId) - + Number.parseInt(b.externalId) + ) }) - await storage.save('tmp/ard-publishers-ordered.json', JSON.stringify(publisher)) + await storage.save( + 'tmp/ard-publishers-ordered.json', + JSON.stringify(publisher) + ) } catch (error) { console.log(error) } diff --git a/tests/ard.test.js b/tests/ard.test.js index 921e5ac..36cabbc 100644 --- a/tests/ard.test.js +++ b/tests/ard.test.js @@ -15,7 +15,9 @@ const { createHashedId } = require('../packages/ard') describe('Test ARD Package', () => { describe('Test ARD-CoreID Hash', () => { it("createHashedId('test') = 0c171b2e54a30c11", () => { - expect(createHashedId('test')).to.equal('0c171b2e54a30c11') + expect(createHashedId('test')).to.equal( + '0c171b2e54a30c11' + ) }) }) }) diff --git a/tests/date.test.js b/tests/date.test.js index b31ca8c..db39523 100644 --- a/tests/date.test.js +++ b/tests/date.test.js @@ -20,49 +20,63 @@ describe('Test DateTime Package', () => { describe('Test getDateHourMinutes', () => { const testResult = 'Di, 19. Januar 2038 - 03:14 Uhr' it(`getDateHourMinutes('${testDate}') = '${testResult}'`, () => { - expect(date.getDateHourMinutes(testDate)).to.equal(testResult) + expect(date.getDateHourMinutes(testDate)).to.equal( + testResult + ) }) }) describe('Test getDayMonthYear', () => { const testResult = 'Di, 19. Januar 2038' it(`getDayMonthYear('${testDate}') = '${testResult}'`, () => { - expect(date.getDayMonthYear(testDate)).to.equal(testResult) + expect(date.getDayMonthYear(testDate)).to.equal( + testResult + ) }) }) describe('Test getFullRelativeTime', () => { const testResult = `Di, 19. Januar 2038 - 03:14 Uhr (in ${relativeYears} Jahren)` it(`getFullRelativeTime('${testDate}') = '${testResult}'`, () => { - expect(date.getFullRelativeTime(testDate)).to.equal(testResult) + expect(date.getFullRelativeTime(testDate)).to.equal( + testResult + ) }) }) describe('Test getHourMinutes', () => { const testResult = '03:14' it(`getHourMinutes('${testDate}') = '${testResult}'`, () => { - expect(date.getHourMinutes(testDate)).to.equal(testResult) + expect(date.getHourMinutes(testDate)).to.equal( + testResult + ) }) }) describe('Test getIsoRelativeTime', () => { const testResult = `${testDate} (in ${relativeYears} Jahren)` it(`getIsoRelativeTime('${testDate}') = '${testResult}'`, () => { - expect(date.getIsoRelativeTime(testDate)).to.equal(testResult) + expect(date.getIsoRelativeTime(testDate)).to.equal( + testResult + ) }) }) describe('Test getRelativeTime', () => { const testResult = `in ${relativeYears} Jahren` it(`getRelativeTime('${testDate}') = '${testResult}'`, () => { - expect(date.getRelativeTime(testDate)).to.equal(testResult) + expect(date.getRelativeTime(testDate)).to.equal( + testResult + ) }) }) describe('Test getYearMonthDay', () => { const testResult = '20380119' it(`getYearMonthDay('${testDate}') = '${testResult}'`, () => { - expect(date.getYearMonthDay(testDate)).to.equal(testResult) + expect(date.getYearMonthDay(testDate)).to.equal( + testResult + ) }) }) diff --git a/tests/numbers.test.js b/tests/numbers.test.js index 882ea7e..e96f00b 100644 --- a/tests/numbers.test.js +++ b/tests/numbers.test.js @@ -25,27 +25,39 @@ describe('Test Numbers Package', () => { describe('Test addTrailingZeros', () => { it("addTrailingZeros(1, 5) = '1.00000'", () => { - expect(numbers.addTrailingZeros(1, 5)).to.equal('1.00000') + expect(numbers.addTrailingZeros(1, 5)).to.equal( + '1.00000' + ) }) it("addTrailingZeros(1.1, 5) = '1.10000'", () => { - expect(numbers.addTrailingZeros(1.1, 5)).to.equal('1.10000') + expect(numbers.addTrailingZeros(1.1, 5)).to.equal( + '1.10000' + ) }) it("addTrailingZeros('1.2', 5) = '1.20000'", () => { - expect(numbers.addTrailingZeros('1.2', 5)).to.equal('1.20000') + expect(numbers.addTrailingZeros('1.2', 5)).to.equal( + '1.20000' + ) }) it("addTrailingZeros(2, 2, ',') = '2,00'", () => { - expect(numbers.addTrailingZeros(2, 2, ',')).to.equal('2,00') + expect(numbers.addTrailingZeros(2, 2, ',')).to.equal( + '2,00' + ) }) it("addTrailingZeros(2.1, 2, ',') = '2,10'", () => { - expect(numbers.addTrailingZeros(2.1, 2, ',')).to.equal('2,10') + expect(numbers.addTrailingZeros(2.1, 2, ',')).to.equal( + '2,10' + ) }) it("addTrailingZeros('2,2', 2, ','') = '2,20'", () => { - expect(numbers.addTrailingZeros('2,2', 2, ',')).to.equal('2,20') + expect( + numbers.addTrailingZeros('2,2', 2, ',') + ).to.equal('2,20') }) }) @@ -55,7 +67,9 @@ describe('Test Numbers Package', () => { }) it('getAverage([1.2, 2.4, 3.6], 1) = 2.4', () => { - expect(numbers.getAverage([1.2, 2.4, 3.6], 1)).to.equal(2.4) + expect(numbers.getAverage([1.2, 2.4, 3.6], 1)).to.equal( + 2.4 + ) }) }) @@ -71,11 +85,15 @@ describe('Test Numbers Package', () => { describe('Test getRandomInRange', () => { it('getRandomInRange(1, 5) = 1,2,3,4 or 5', () => { - expect([1, 2, 3, 4, 5]).to.include(numbers.getRandomInRange(1, 5)) + expect([1, 2, 3, 4, 5]).to.include( + numbers.getRandomInRange(1, 5) + ) }) it('getRandomInRange(5, 9) = 5,6,7,8 or 9', () => { - expect([5, 6, 7, 8, 9]).to.include(numbers.getRandomInRange(5, 9)) + expect([5, 6, 7, 8, 9]).to.include( + numbers.getRandomInRange(5, 9) + ) }) }) @@ -121,7 +139,9 @@ describe('Test Numbers Package', () => { describe('Test toReadable', () => { it("toReadable(1234567) = '1.234.567'", () => { - expect(numbers.toReadable(1234567)).to.equal('1.234.567') + expect(numbers.toReadable(1234567)).to.equal( + '1.234.567' + ) }) }) }) diff --git a/tests/strings.test.js b/tests/strings.test.js index 2c28064..3c9591f 100644 --- a/tests/strings.test.js +++ b/tests/strings.test.js @@ -24,11 +24,18 @@ describe('Test Strings Package', () => { describe('Test getObjectLength', () => { it("getObjectLength({ hello: 'world' }) = 1", () => { - expect(strings.getObjectLength({ hello: 'world' })).to.equal(1) + expect( + strings.getObjectLength({ hello: 'world' }) + ).to.equal(1) }) it("getObjectLength({ hello: 'world', foo: 'bar' }) = 2", () => { - expect(strings.getObjectLength({ hello: 'world', foo: 'bar' })).to.equal(2) + expect( + strings.getObjectLength({ + hello: 'world', + foo: 'bar', + }) + ).to.equal(2) }) }) @@ -38,7 +45,9 @@ describe('Test Strings Package', () => { }) it("isArray({ hello: 'world' }) = false", () => { - expect(strings.isArray({ hello: 'world' })).to.equal(false) + expect(strings.isArray({ hello: 'world' })).to.equal( + false + ) }) }) @@ -48,7 +57,9 @@ describe('Test Strings Package', () => { }) it("isEmptyArray(['hello world']) = false", () => { - expect(strings.isEmptyArray(['hello world'])).to.equal(false) + expect(strings.isEmptyArray(['hello world'])).to.equal( + false + ) }) }) @@ -58,7 +69,9 @@ describe('Test Strings Package', () => { }) it("isEmptyObject({ hello: 'world' }) = false", () => { - expect(strings.isEmptyObject({ hello: 'world' })).to.equal(false) + expect( + strings.isEmptyObject({ hello: 'world' }) + ).to.equal(false) }) }) @@ -68,17 +81,23 @@ describe('Test Strings Package', () => { }) it("isEmptyString('hello world') = false", () => { - expect(strings.isEmptyString('hello world')).to.equal(false) + expect(strings.isEmptyString('hello world')).to.equal( + false + ) }) }) describe('Test isIncluded', () => { it("isIncluded('hello world', 'hello') = true", () => { - expect(strings.isIncluded('hello world', 'hello')).to.equal(true) + expect( + strings.isIncluded('hello world', 'hello') + ).to.equal(true) }) it("isIncluded('hello world', 'earth') = false", () => { - expect(strings.isIncluded('hello world', 'earth')).to.equal(false) + expect( + strings.isIncluded('hello world', 'earth') + ).to.equal(false) }) }) @@ -94,7 +113,9 @@ describe('Test Strings Package', () => { describe('Test isObject', () => { it("isObject({ hello: 'world' }) = true", () => { - expect(strings.isObject({ hello: 'world' })).to.equal(true) + expect(strings.isObject({ hello: 'world' })).to.equal( + true + ) }) it("isObject('hello world') = false", () => { @@ -114,7 +135,9 @@ describe('Test Strings Package', () => { describe('Test notEmptyArray', () => { it("notEmptyArray(['hello world']) = true", () => { - expect(strings.notEmptyArray(['hello world'])).to.equal(true) + expect(strings.notEmptyArray(['hello world'])).to.equal( + true + ) }) it('notEmptyArray([]) = false', () => { @@ -124,7 +147,9 @@ describe('Test Strings Package', () => { describe('Test notEmptyObject', () => { it("notEmptyObject({ hello: 'world' }) = true", () => { - expect(strings.notEmptyObject({ hello: 'world' })).to.equal(true) + expect( + strings.notEmptyObject({ hello: 'world' }) + ).to.equal(true) }) it('notEmptyObject({}) = false', () => { @@ -134,7 +159,9 @@ describe('Test Strings Package', () => { describe('Test notNullOrUndefined', () => { it("notNullOrUndefined('hello world') = true", () => { - expect(strings.notNullOrUndefined('hello world')).to.equal(true) + expect( + strings.notNullOrUndefined('hello world') + ).to.equal(true) }) it('notNullOrUndefined(null) = false', () => { @@ -142,43 +169,59 @@ describe('Test Strings Package', () => { }) it('notNullOrUndefined(undefined) = false', () => { - expect(strings.notNullOrUndefined(undefined)).to.equal(false) + expect(strings.notNullOrUndefined(undefined)).to.equal( + false + ) }) }) describe('Test pluralize', () => { it("pluralize(1, 'Apple') = '1 Apple'", () => { - expect(strings.pluralize(1, 'Apple')).to.equal('1 Apple') + expect(strings.pluralize(1, 'Apple')).to.equal( + '1 Apple' + ) }) it("pluralize(1000, 'Apple') = '1.000 Apples'", () => { - expect(strings.pluralize(1000, 'Apple')).to.equal('1.000 Apples') + expect(strings.pluralize(1000, 'Apple')).to.equal( + '1.000 Apples' + ) }) it("pluralize(1, 'Child', 'Children') = '1 Child'", () => { - expect(strings.pluralize(1, 'Child', 'Children')).to.equal('1 Child') + expect( + strings.pluralize(1, 'Child', 'Children') + ).to.equal('1 Child') }) it("pluralize(1000, 'Child', 'Children') = '1.000 Children'", () => { - expect(strings.pluralize(1000, 'Child', 'Children')).to.equal('1.000 Children') + expect( + strings.pluralize(1000, 'Child', 'Children') + ).to.equal('1.000 Children') }) }) describe('Test removeDoubleSpaces', () => { it("removeDoubleSpaces('hello world')) = 'hello world'", () => { - expect(strings.removeDoubleSpaces('hello world')).to.equal('hello world') + expect( + strings.removeDoubleSpaces('hello world') + ).to.equal('hello world') }) it("removeDoubleSpaces('hello world once again')) = 'hello world once again'", () => { - expect(strings.removeDoubleSpaces('hello world once again')).to.equal( - 'hello world once again' - ) + expect( + strings.removeDoubleSpaces( + 'hello world once again' + ) + ).to.equal('hello world once again') }) }) describe('Test toHex', () => { it("toHex('hello world')) = '68656c6c6f20776f726c64'", () => { - expect(strings.toHex('hello world')).to.equal('68656c6c6f20776f726c64') + expect(strings.toHex('hello world')).to.equal( + '68656c6c6f20776f726c64' + ) }) }) }) diff --git a/utils/date/getDateHourMinutes.js b/utils/date/getDateHourMinutes.js index fcc9704..738de47 100644 --- a/utils/date/getDateHourMinutes.js +++ b/utils/date/getDateHourMinutes.js @@ -2,4 +2,5 @@ const { DateTime } = require('luxon') // returns 'Di, 19. Januar 2038 - 03:14 Uhr' const dayHourMinutes = 'ccc, d. LLLL yyyy - HH:mm' -module.exports = (date) => `${DateTime.fromISO(date).setLocale('de').toFormat(dayHourMinutes)} Uhr` +module.exports = (date) => + `${DateTime.fromISO(date).setLocale('de').toFormat(dayHourMinutes)} Uhr` diff --git a/utils/date/getDayMonthYear.js b/utils/date/getDayMonthYear.js index cc387c8..a26c0a2 100644 --- a/utils/date/getDayMonthYear.js +++ b/utils/date/getDayMonthYear.js @@ -1,4 +1,5 @@ const { DateTime } = require('luxon') // returns 'Do, 1. Januar 1970' -module.exports = (date) => DateTime.fromISO(date).setLocale('de').toFormat('ccc, d. LLLL yyyy') +module.exports = (date) => + DateTime.fromISO(date).setLocale('de').toFormat('ccc, d. LLLL yyyy') diff --git a/utils/date/getFullRelativeTime.js b/utils/date/getFullRelativeTime.js index edcab2d..bc949d0 100644 --- a/utils/date/getFullRelativeTime.js +++ b/utils/date/getFullRelativeTime.js @@ -2,4 +2,5 @@ const getDateHourMinutes = require('./getDateHourMinutes') const getRelativeTime = require('./getRelativeTime') // returns 'Do, 1. Januar 1970 - 00:00 Uhr (in YY Jahren)' -module.exports = (date) => `${getDateHourMinutes(date)} (${getRelativeTime(date)})` +module.exports = (date) => + `${getDateHourMinutes(date)} (${getRelativeTime(date)})` diff --git a/utils/date/getYearMonthDay.js b/utils/date/getYearMonthDay.js index 1b778a8..e5f460b 100644 --- a/utils/date/getYearMonthDay.js +++ b/utils/date/getYearMonthDay.js @@ -1,4 +1,5 @@ const { DateTime } = require('luxon') // get YYYYMMDD (returns '19700101') -module.exports = (date) => DateTime.fromISO(date).setLocale('de').toFormat('yyyyLLdd') +module.exports = (date) => + DateTime.fromISO(date).setLocale('de').toFormat('yyyyLLdd') diff --git a/utils/helpers/arrayToObjectCount.js b/utils/helpers/arrayToObjectCount.js index fe6ef00..eec2222 100644 --- a/utils/helpers/arrayToObjectCount.js +++ b/utils/helpers/arrayToObjectCount.js @@ -1,7 +1,6 @@ // reduce array elements to object with count module.exports = (array) => { return array.reduce((obj, name) => { - // eslint-disable-next-line no-plusplus obj[name] = obj[name] ? ++obj[name] : 1 return obj }, {}) diff --git a/utils/numbers/getSum.js b/utils/numbers/getSum.js index f91273e..77a2e7a 100644 --- a/utils/numbers/getSum.js +++ b/utils/numbers/getSum.js @@ -1,4 +1,5 @@ // get sum from array of values const roundTo = require('./roundTo') -module.exports = (arr, decimals = 2) => arr.reduce((a, b) => roundTo(a + b, decimals), 0) +module.exports = (arr, decimals = 2) => + arr.reduce((a, b) => roundTo(a + b, decimals), 0) diff --git a/utils/strings/isObject.js b/utils/strings/isObject.js index 086ace1..ca19a1d 100644 --- a/utils/strings/isObject.js +++ b/utils/strings/isObject.js @@ -3,4 +3,5 @@ const isArray = require('./isArray') const notNullOrUndefined = require('./notNullOrUndefined') // check if a variable is really an object -module.exports = (value) => notNullOrUndefined(value) && value instanceof Object && !isArray(value) +module.exports = (value) => + notNullOrUndefined(value) && value instanceof Object && !isArray(value)