Skip to content

Instantly share code, notes, and snippets.

@ngbrown
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngbrown/953502517ccabd5bd264 to your computer and use it in GitHub Desktop.
Save ngbrown/953502517ccabd5bd264 to your computer and use it in GitHub Desktop.
Determine lines of code
Function IIf($If, $IfTrue, $IfFalse) {
If ($If -IsNot "Boolean") {$_ = $If}
If ($If) {If ($IfTrue -is "ScriptBlock") {&$IfTrue} Else {$IfTrue}}
Else {If ($IfFalse -is "ScriptBlock") {&$IfFalse} Else {$IfFalse}}
}
Get-ChildItem -include *.js -exclude *.min.js -recurse | ?{$_.fullname -notmatch "\\node_modules\\?"}
Get-ChildItem -include *.js -recurse | select-string . | Group-Object Path -NoElement | ForEach-Object {IIf($_.Count -le 50) "a. <=50" {IIf($_.Count -le 100) "b. <=100" {IIf($_.Count -le 200) "c. <=200" {IIf($_.Count -le 500) "d. <=500" "e. >500"}}}} | Group-Object -NoElement | Sort-Object Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment