Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
commenthol committed Nov 3, 2017
1 parent a782bfb commit 1c3c805
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 84 deletions.
28 changes: 14 additions & 14 deletions scripts/attributions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ Attributions.prototype = {
console.log(list.length, 'files read')

this.data = list
.map((file) => {
if (config.fileRegex.test(file)) {
return this._load(path.resolve(config.countries, file))
}
return ''
})
.join('')
.split(/[\n\r]/)
.map((file) => {
if (config.fileRegex.test(file)) {
return this._load(path.resolve(config.countries, file))
}
return ''
})
.join('')
.split(/[\n\r]/)

return this
},
Expand All @@ -65,12 +65,12 @@ Attributions.prototype = {
return true
}
})
.map((d) => {
return d
.replace(/#\s*@attrib/, '')
.trim()
})
.sort()
.map((d) => {
return d
.replace(/#\s*@attrib/, '')
.trim()
})
.sort()

this.data = uniq(data).join('\n')

Expand Down
18 changes: 9 additions & 9 deletions scripts/holidays2json.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ Holidays2json.prototype = {
getList: function () {
var list = fs.readdirSync(config.countries)
list = list
.map(function (file) {
if (REGEX.test(file)) {
return file.replace(REGEX, '$1')
}
})
.filter(function (file) {
return file
})
.sort()
.map(function (file) {
if (REGEX.test(file)) {
return file.replace(REGEX, '$1')
}
})
.filter(function (file) {
return file
})
.sort()
this.list = list
return this
},
Expand Down
6 changes: 3 additions & 3 deletions src/DateFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class DateFn {
var calEvent
if (rule.fn) {
calEvent = new CalEventFactory(rule)
.inYear(year - 1) // run over neighboring dates to catch overlaps
.inYear(year)
.inYear(year + 1)
.inYear(year - 1) // run over neighboring dates to catch overlaps
.inYear(year)
.inYear(year + 1)
postProc.push(calEvent)
ruleFn = new Rule(calEvent)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class Equinox extends CalEvent {
var date
if (/^[+-]\d{2}:\d{2}?$/.test(this._timezone)) { // for '+08:00' formats
date = moment(str).utcOffset(this._timezone)
} else { // for 'Asia/Shanghai' formats
date = moment(str).tz(this._timezone) // move to timezone
} else { // for 'Asia/Shanghai' formats
date = moment(str).tz(this._timezone) // move to timezone
}

var floorDate = {
Expand Down
48 changes: 24 additions & 24 deletions src/Holidays.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,22 @@ Holidays.prototype = {
arr = arr.sort(function (a, b) {
return (+a.start) - (+b.start)
})
.map(function (a, i) {
var b = arr[i + 1]
if (b && (a.name === b.name) && (+a.start) === (+b.start)) {
for (var type of TYPES) {
if (type === a.type || type === b.type) {
a.filter = true
b.type = type
break
.map(function (a, i) {
var b = arr[i + 1]
if (b && (a.name === b.name) && (+a.start) === (+b.start)) {
for (var type of TYPES) {
if (type === a.type || type === b.type) {
a.filter = true
b.type = type
break
}
}
}
}
return a
})
.filter(function (a) {
if (!a.filter) return a
})
return a
})
.filter(function (a) {
if (!a.filter) return a
})

return arr
},
Expand Down Expand Up @@ -330,16 +330,16 @@ Holidays.prototype = {
}
var tmp = {}
this.__languages = [].concat(
language,
'en',
(this.__conf ? this.__data.getLanguages() : [])
).filter(function (l) { // filter out duplicates
if (!l || tmp[l]) {
return false
}
tmp[l] = 1
return true
})
language,
'en',
(this.__conf ? this.__data.getLanguages() : [])
).filter(function (l) { // filter out duplicates
if (!l || tmp[l]) {
return false
}
tmp[l] = 1
return true
})
},

/**
Expand Down
54 changes: 27 additions & 27 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,43 +67,43 @@ const grammar = (function () {
}
/* eslint-disable func-call-spacing */
raw._days = replace(raw._days)
(/_weekdays/, raw._weekdays)
()
(/_weekdays/, raw._weekdays)
()
raw.julian = replace(raw.julian, '')
(/date/, raw.date)
()
(/date/, raw.date)
()
raw.easter = replace(raw.easter, '')
(/_count_days/, raw._count_days)
()
(/_count_days/, raw._count_days)
()
raw.equinox = replace(raw.equinox, '')
(/_count_days/g, raw._count_days)
(/_direction/g, raw._direction)
(/_timezone/g, raw._timezone)
()
(/_count_days/g, raw._count_days)
(/_direction/g, raw._direction)
(/_timezone/g, raw._timezone)
()
raw.hebrew = replace(raw.hebrew, '')
(/_hebrewMonths/, raw._hebrewMonths)
()
(/_hebrewMonths/, raw._hebrewMonths)
()
raw.islamic = replace(raw.islamic, '')
(/_islamicMonths/, raw._islamicMonths)
()
(/_islamicMonths/, raw._islamicMonths)
()
raw.dateMonth = replace(raw.dateMonth)
(/_months/, raw._months)
()
(/_months/, raw._months)
()

raw.rule_date_if_then = replace(raw.rule_date_if_then, '')
(/_direction/g, raw._direction)
(/_weekdays/g, raw._weekdays)
(/_days/g, raw._days)
()
(/_direction/g, raw._direction)
(/_weekdays/g, raw._weekdays)
(/_days/g, raw._days)
()
raw.rule_day_dir_date = replace(raw.rule_day_dir_date, '')
(/_counts/, raw._counts)
(/_days/g, raw._days)
(/_direction/g, raw._direction)
()
(/_counts/, raw._counts)
(/_days/g, raw._days)
(/_direction/g, raw._direction)
()
raw.rule_type_if_then = replace(raw.rule_type_if_then, '')
(/_direction/g, raw._direction)
(/_days/g, raw._days)
()
(/_direction/g, raw._direction)
(/_days/g, raw._days)
()

var i = 1
raw.months = {}
Expand Down
10 changes: 5 additions & 5 deletions src/internal/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
exports.DAYS = (function () {
var o = {}
'sunday|monday|tuesday|wednesday|thursday|friday|saturday'
.split('|')
.forEach((name, idx) => {
o[name] = idx
o[idx] = name
})
.split('|')
.forEach((name, idx) => {
o[name] = idx
o[idx] = name
})
return o
})()

Expand Down

0 comments on commit 1c3c805

Please sign in to comment.