Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mreis1/83c3f5fc29d7af949afe0cb781e6976e to your computer and use it in GitHub Desktop.
Save mreis1/83c3f5fc29d7af949afe0cb781e6976e to your computer and use it in GitHub Desktop.
//form a npm depency list extract the exact version a generate a string for npm install
var obj = { "@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/material": "^2.0.0-beta.1",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "~3.4.0",
"@angular/upgrade": "^2.1.0", }
var str = "";
for (var i in obj) {
str+= " " + i + '@' + obj[i].replace(/(~|\^)/g,'')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment