mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 14:36:08 +00:00

Greatly simplify how ESLint and its plugins are installed. PR-URL: https://github.com/nodejs/node/pull/53413 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
36 lines
670 B
JavaScript
36 lines
670 B
JavaScript
'use strict'
|
|
|
|
var hasOwnProperty = require('../constant/has-own-property.js')
|
|
|
|
// Combine several HTML extensions into one.
|
|
function combineHtmlExtensions(extensions) {
|
|
var handlers = {}
|
|
var index = -1
|
|
|
|
while (++index < extensions.length) {
|
|
extension(handlers, extensions[index])
|
|
}
|
|
|
|
return handlers
|
|
}
|
|
|
|
function extension(handlers, extension) {
|
|
var hook
|
|
var left
|
|
var right
|
|
var type
|
|
|
|
for (hook in extension) {
|
|
left = hasOwnProperty.call(handlers, hook)
|
|
? handlers[hook]
|
|
: (handlers[hook] = {})
|
|
right = extension[hook]
|
|
|
|
for (type in right) {
|
|
left[type] = right[type]
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = combineHtmlExtensions
|