You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
645 B
23 lines
645 B
function parseApis (modules, test) {
|
|
return modules.reduce(function (apis, module) {
|
|
const apiList = module.apiList
|
|
apiList && Object.keys(apiList).forEach(name => {
|
|
if (test(name, apiList[name])) {
|
|
apis.add(name.replace('uni.', ''))
|
|
}
|
|
})
|
|
return apis
|
|
}, new Set())
|
|
}
|
|
|
|
module.exports = {
|
|
parseUserApis (configModules = [], allModules = []) {
|
|
const blackboxApis = parseApis(configModules, function (name, value) {
|
|
return value === false
|
|
})
|
|
const allApis = parseApis(allModules, function () {
|
|
return true
|
|
})
|
|
return [...allApis].filter(name => !blackboxApis.has(name))
|
|
}
|
|
}
|
|
|