Security update for permissions_by_term
[yaffs-website] / node_modules / in-publish / index.js
1 'use strict'
2 function inCommand (cmd) {
3   try {
4     var npm_config_argv = JSON.parse(process.env['npm_config_argv'])
5   } catch (e) {
6     return false
7   }
8
9   if (typeof npm_config_argv !== 'object') process.exit(1)
10   if (!npm_config_argv.cooked) process.exit(1)
11   if (!npm_config_argv.cooked instanceof Array) process.exit(1)
12
13   var V
14   while ((V = npm_config_argv.cooked.shift()) !== undefined) {
15     if (/^-/.test(V)) continue
16     if (cmd.test(V)) return true
17     return false
18   }
19   return false
20 }
21
22 exports.inPublish = function () {
23   return inCommand(/^pu(b(l(i(sh?)?)?)?)?$/)
24 }
25
26 exports.inInstall = function () {
27   return inCommand(/^i(n(s(t(a(ll?)?)?)?)?)?$/)
28 }