@jeffjade
2017-06-01T10:56:14.000000Z
字数 1119
阅读 986
javascript
// 求交集(a ∩ b)两种方法
let intersection = a.filter(v => b.includes(v))
let intersectionSet = Array.from(new Set([...a].filter(x => b.includes(x))))
// 求差集(a - b)两种方法
let difference = a.concat(b).filter(v => !a.includes(v) || !b.includes(v))
let differenceSet = Array.from(new Set([...a].filter(x => !b.includes(x))))
// 求并集(a + b)两种方法
let union = a.concat(b).filter(function(item, index, array) {
return array.indexOf(item) === index;
})
let unionSet = Array.from(new Set([...a, ...b]))
// let defMaps = {}
// let executive = require('./executive').default
// let finance = require('./finance').default
// let design = require('./design').default
// let market = require('./market').default
// let legal = require('./legal').default
// let it = require('./it').default
// let hr = require('./hr').default
// Object.assign(
// defMaps,
// executive,
// finance,
// design,
// market,
// legal,
// hr,
// it
// )
// export const $maps = defMaps
const files = require.context('.', true, /\.js$/)
const configs = {}
const moudles = []
files.keys().forEach((key) => {
if (key === './index.js') return
moudles[key.replace(/(\.\/|\.js)/g, '')] = files(key)
})
for (let key in moudles) {
Object.assign(configs, moudles[key].default)
}
export const $maps = configs