compose 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new49

Compose with language operators

Try to use composition functions with language operators! You can use right (classic) and left composition.

You have two ways to define your composition: >> and *. Its same! For calling you need to use < (from left function) or > (from right function).

Examples

var addOne = (x) => x + 1;
var minusOne = (x) => x - 1;
var add = (x, v) => x + v;

print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) > 3); // 7
print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) < 3); // 7

print(c() * addOne * ((_) => _ * 2) > 4); // 9
print(c() * addOne * ((_) => _ * 2) < 4); // 10

example/example.dart

import 'package:compose/compose.dart';

void main() {
  var addOne = (x) => x + 1;
  var minusOne = (x) => x - 1;
  var add = (x, v) => x + v;

  print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) > 3); // 7
  print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) < 3); // 7

  print(c() * addOne * ((_) => _ * 2) > 4); // 9
  print(c() * addOne * ((_) => _ * 2) < 4); // 10
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  compose: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:compose/compose.dart';
  
Version Uploaded Documentation Archive
0.1.1 Nov 15, 2018 Go to the documentation of compose 0.1.1 Download compose 0.1.1 archive
0.1.0 Nov 15, 2018 Go to the documentation of compose 0.1.0 Download compose 0.1.0 archive
0.0.2 Nov 15, 2018 Go to the documentation of compose 0.0.2 Download compose 0.0.2 archive
0.0.1 Nov 15, 2018 Go to the documentation of compose 0.0.1 Download compose 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
5
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:compose/compose.dart.

Health issues and suggestions

Document public APIs (-10 points)

7 out of 7 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.67.0 <3.0.0
Dev dependencies
test ^1.3.0