Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 976 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 976 Bytes

OnionFunc

Build status NuGet

OnionFunc は middleware pattern によってパイプラインを構築する為の、非常にシンプルな .NET ヘルパーライブラリです。

Target Frameworks

  • .NET Standard 2.0+
  • .NET Standard 1.0+
  • .NET Framework 4.5+

Usage

Func<int, bool> handler = num => true;
Assert.AreEqual(true, handler(24));

Func<int, bool> onionFunc = handler
    .Layer(next => num => (num % 3 == 0) && next(num))
    .Layer(next => num => (num % 4 == 0) && next(num))
    ;
Assert.AreEqual(true, onionFunc(24));
Assert.AreEqual(false, onionFunc(30));

Licence

This project is licensed under the MIT License - see the LICENSE file for details