Skip to content

Instantly share code, notes, and snippets.

@ivan-kleshnin
Created January 31, 2015 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-kleshnin/d8e14faffaafe36bfaca to your computer and use it in GitHub Desktop.
Save ivan-kleshnin/d8e14faffaafe36bfaca to your computer and use it in GitHub Desktop.
Check npm package is installed
function npm_package_is_installed {
if [ $(npm list --depth 0 --parseable true "${2}" | grep "${1}$") ]; then
echo "1"
else
echo "0"
fi
}
# npm_package_is_installed gulp
# npm_package_is_installed gulp -g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment