Coder Social home page Coder Social logo

pslinq's Introduction

#pslinq

LINQ for Powershell.

##Available cmdlets

The following cmdlets are available as of now:

Aggregate-List

All-List

Any-List

Except-List

First-List

Intersect-List

Repeat-List

SelectMany-List

Single-List

Skip-List

SkipWhile-List

Take-List

TakeWhile-List

Union-List

Zip-List

Based on MoreLinq:

TakeEvery-List

###Aggregate-List

Examples:

Sum:

1..10 | Aggregate-List { $input + $acc} -seed 10
#65

Product:

1..10 | Aggregate-List { $acc * $input } -seed 1

String reverse:

"abcdefg" -split '' | Aggregate-List { $input + $acc }
#gfedcba

###All-List

Examples:

1..10 | All-List { $input -le 6 }
#False

###Any-List

Examples:

1..10 | Any-List { $input -eq 5 }
#True

###Except-List

Examples:

1..10 | Except-List 1,3,5,7
#2
#4
#6
#8
#9
#10

###First-List

Examples:

1..10 | First-List { $input -eq 5 }
#5
1..10 | First-List { $input -eq 11 }
#Throws exception

###Intersect-List

Example:

1..10 | Intersect-List $(5..15)
#5
#6
#7
#8
#9
#10

###Repeat-List

Example:

1..3 | Repeat-List 2
#1
#1
#2
#2
#3
#3

###SelectMany-List

Example:

"abc", "def" | SelectMany-List { $input.ToCharArray() }
#a
#b
#c
#d
#e
#f

###Single-List

Example:

1..10 | Single-List { $input -eq 5 }
#5
1..10 | Single-List { $input -ge 5 }
#Throws exception
1..10 | Single-List { $input -eq 11 }
#Throws exception

###Skip-List

Example:

1..10 | Skip-List 6
#7
#8
#9
#10

###SkipWhile-List

Example:

1..10 | SkipWhile-List { $input -le 8 }
#9
#10

###Take-List

Example:

1..10 | Take-List 3
#1
#2
#3

1..10 | Skip-List 3 | Take-List 3
#4
#5
#6

###TakeWhile-List

Example:

1..10 | TakeWhile-List { $input -lt 4 }
#1
#2
#3

###Union-List

Example:

"a", "b", "c" | Union-List "c", "d"
#a
#b
#c
#d

###Zip-List

Example:

"a", "b", "c" | Zip-List $(1..4) { $first + $second }
#a1
#b2
#c3

"a", "b", "c" | Zip-List $(1..3) { $first * $second }
#a
#bb
#ccc

##Based on MoreLinq:

###TakeEvery-List

1..10 | TakeEvery-List 2
#2
#4
#6
#8
#10

pslinq's People

Contributors

manojlds avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.