Skip to content

Commit c1eb1ef

Browse files
committed
Fix lint
1 parent 327eea8 commit c1eb1ef

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'use strict'
22

3-
const { getValue, titleize } = require('@metascraper/helpers')
3+
const {getValue, titleize} = require('@metascraper/helpers')
44

55
module.exports = () => ({
66
author: [
7-
({ htmlDom: $, meta, url: baseUrl }) =>
8-
titleize(getValue($, $('.soundTitle__username')))
7+
({htmlDom: $, meta, url: baseUrl}) =>
8+
titleize(getValue($, $('.soundTitle__username')))
99
],
1010
description: [
11-
({ htmlDom: $, meta, url: baseUrl }) =>
11+
({htmlDom: $, meta, url: baseUrl}) =>
1212
titleize(
1313
$('.soundTitle__description')
1414
.first()
1515
.text(),
16-
{ capitalize: false }
16+
{capitalize: false}
1717
)
1818
]
1919
})

packages/metascraper/src/load-rules.js

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@ const cwd = process.env.METASCRAPER_CWD || process.cwd()
44
const config = require('cosmiconfig')('metascraper').load(cwd)
55
const resolveFrom = require('resolve-from')
66

7-
const {
8-
map,
9-
findIndex,
10-
forEach,
11-
chain,
12-
isObject,
13-
isArray,
14-
isString,
15-
get
16-
} = require('lodash')
7+
const {map, findIndex, forEach, chain, isObject, isArray, isString, get} = require('lodash')
178

189
const DEFAULT_RULES = [
1910
'metascraper-author',
@@ -30,25 +21,22 @@ const DEFAULT_RULES = [
3021

3122
const load = rules =>
3223
chain(rules)
33-
// merge rules with same props
34-
.reduce((acc, rules) => {
35-
forEach(rules, function (rule, propName) {
36-
const index = findIndex(acc, item => item[propName])
37-
if (index !== -1) {
38-
acc[index][propName] = acc[index][propName].concat(rule)
39-
} else {
40-
acc.push({ [propName]: rule })
41-
}
24+
// merge rules with same props
25+
.reduce((acc, rules) => {
26+
forEach(rules, function (rule, propName) {
27+
const index = findIndex(acc, item => item[propName])
28+
if (index !== -1) acc[index][propName] = acc[index][propName].concat(rule)
29+
else acc.push({[propName]: rule})
30+
})
31+
return acc
32+
}, [])
33+
// export an array interface, it's easier to iterate
34+
.map(obj => {
35+
const key = Object.keys(obj)[0]
36+
const value = obj[key]
37+
return [key, value]
4238
})
43-
return acc
44-
}, [])
45-
// export an array interface, it's easier to iterate
46-
.map(obj => {
47-
const key = Object.keys(obj)[0]
48-
const value = obj[key]
49-
return [key, value]
50-
})
51-
.value()
39+
.value()
5240

5341
const autoload = async () => {
5442
const configFile = await config

0 commit comments

Comments
 (0)