makeOutHosts.js 367 B

1234567891011121314151617181920212223
  1. /**
  2. * @author oldj
  3. * @blog https://oldj.net
  4. *
  5. * 输出 hosts,提供给系统等应用
  6. */
  7. 'use strict'
  8. function getHostsContent(item) {
  9. return item.content || ''
  10. }
  11. module.exports = (list) => {
  12. let items = []
  13. list.map(item => {
  14. if (item.on) {
  15. items.push(item)
  16. }
  17. })
  18. return items.map(item => getHostsContent(item, list)).join('\n\n')
  19. }