"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/install/is-dev.js" (8 Mar 2017, 622 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 'use strict'
    2 var moduleName = require('../utils/module-name.js')
    3 
    4 function andIsDev (name) {
    5   return function (req) {
    6     return req.package &&
    7       req.package.devDependencies &&
    8       req.package.devDependencies[name]
    9   }
   10 }
   11 
   12 exports.isDev = function (node) {
   13   return node.requiredBy.some(andIsDev(moduleName(node)))
   14 }
   15 
   16 function andIsOnlyDev (name) {
   17   var isThisDev = andIsDev(name)
   18   return function (req) {
   19     return isThisDev(req) &&
   20       (!req.package.dependencies || !req.package.dependencies[name])
   21   }
   22 }
   23 
   24 exports.isOnlyDev = function (node) {
   25   return node.requiredBy.every(andIsOnlyDev(moduleName(node)))
   26 }