Skip to content

Commit

Permalink
feat(fp): convert fp to sub-package, and add fp to all group packages
Browse files Browse the repository at this point in the history
Convert fp support to sub-package in all packages that support fp.
Adding a sub-package of fp to all group packages, for the exports of all methods that in the group that have support in fp.

BREAKING CHANGES:
remove "@promises/-fp" package, use "@promises/-all/fp" sub-package instead.
  • Loading branch information
yisraelx committed Jun 26, 2018
1 parent 1e89c39 commit 94bebb3
Show file tree
Hide file tree
Showing 63 changed files with 448 additions and 104 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import '@promises/sleep/add';
```
import all models that have Functional programming support
```ts
import * as FP from '@promises/-fp';
import * as PF from '@promises/-all/fp';
```
Or import only the module you need
```ts
Expand Down Expand Up @@ -104,7 +104,7 @@ sleep.then((result: number[]) => {
```ts
import filterParallel from '@promises/filter-parallel/fp';
import mapParallel from '@promises/map-parallel/fp';
import { sleep } from '@promises/-fp';
import { sleep } from '@promises/-all/fp';

let array: number[] = [1, 2, 3];
let filterOdd = filterParallel((value: number) => value % 2 !== 0)(Infinity);
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"lerna": "2.9.0",
"packages": [
"modules/**"
"modules/*"
],
"version": "0.4.0"
}
30 changes: 30 additions & 0 deletions modules/-all/fp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @module @promises/-all/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/

export {default as error} from '@promises/error/fp';
export {default as everyParallel} from '@promises/every-parallel/fp';
export {default as everySeries} from '@promises/every-series/fp';
export {default as filterParallel} from '@promises/filter-parallel/fp';
export {default as filterSeries} from '@promises/filter-series/fp';
export {default as finally} from '@promises/finally/fp';
export {default as forEachParallel} from '@promises/for-each-parallel/fp';
export {default as forEachRightSeries} from '@promises/for-each-right-series/fp';
export {default as forEachSeries} from '@promises/for-each-series/fp';
export {default as mapParallel} from '@promises/map-parallel/fp';
export {default as mapSeries} from '@promises/map-series/fp';
export {default as next} from '@promises/next/fp';
export {default as reduceRightSeries} from '@promises/reduce-right-series/fp';
export {default as reduceSeries} from '@promises/reduce-series/fp';
export {default as rejectParallel} from '@promises/reject-parallel/fp';
export {default as rejectSeries} from '@promises/reject-series/fp';
export {default as reset} from '@promises/reset/fp';
export {default as sleep} from '@promises/sleep/fp';
export {default as someParallel} from '@promises/some-parallel/fp';
export {default as someSeries} from '@promises/some-series/fp';
export {default as timesParallel} from '@promises/times-parallel/fp';
export {default as timesSeries} from '@promises/times-series/fp';
export {default as toCallback} from '@promises/to-callback/fp';
export {default as wait} from '@promises/wait/fp';
9 changes: 9 additions & 0 deletions modules/-all/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@promises/-all/fp",
"main": "es5.js",
"browser": "umd.min.js",
"module": "index.js",
"es2015": "index.js",
"typings": "index.d.ts",
"bundle": "bundle.min.js"
}
9 changes: 9 additions & 0 deletions modules/-constructor/fp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @module @promises/-constructor/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/

export {default as timesParallel} from '@promises/times-parallel/fp';
export {default as timesSeries} from '@promises/times-series/fp';

9 changes: 9 additions & 0 deletions modules/-constructor/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@promises/-constructor/fp",
"main": "es5.js",
"browser": "umd.min.js",
"module": "index.js",
"es2015": "index.js",
"typings": "index.d.ts",
"bundle": "bundle.min.js"
}
12 changes: 0 additions & 12 deletions modules/-fp/CHANGELOG.md

This file was deleted.

59 changes: 0 additions & 59 deletions modules/-fp/package.json

This file was deleted.

13 changes: 13 additions & 0 deletions modules/-parallel/fp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @module @promises/-parallel/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/

export { default as everyParallel } from '@promises/every-parallel/fp';
export { default as filterParallel } from '@promises/filter-parallel/fp';
export { default as forEachParallel } from '@promises/for-each-parallel/fp';
export { default as mapParallel } from '@promises/map-parallel/fp';
export { default as rejectParallel } from '@promises/reject-parallel/fp';
export { default as someParallel } from '@promises/some-parallel/fp';
export { default as timesParallel } from '@promises/times-parallel/fp';
9 changes: 9 additions & 0 deletions modules/-parallel/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@promises/-parallel/fp",
"main": "es5.js",
"browser": "umd.min.js",
"module": "index.js",
"es2015": "index.js",
"typings": "index.d.ts",
"bundle": "bundle.min.js"
}
5 changes: 1 addition & 4 deletions modules/-fp/index.ts → modules/-prototype/fp/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @module @promises/-fp
* @module @promises/-prototype/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
Expand All @@ -13,7 +13,6 @@ export { default as finally } from '@promises/finally/fp';
export { default as forEachParallel } from '@promises/for-each-parallel/fp';
export { default as forEachRightSeries } from '@promises/for-each-right-series/fp';
export { default as forEachSeries } from '@promises/for-each-series/fp';
export * from '@promises/interfaces';
export { default as mapParallel } from '@promises/map-parallel/fp';
export { default as mapSeries } from '@promises/map-series/fp';
export { default as next } from '@promises/next/fp';
Expand All @@ -25,7 +24,5 @@ export { default as reset } from '@promises/reset/fp';
export { default as sleep } from '@promises/sleep/fp';
export { default as someParallel } from '@promises/some-parallel/fp';
export { default as someSeries } from '@promises/some-series/fp';
export { default as timesParallel } from '@promises/times-parallel/fp';
export { default as timesSeries } from '@promises/times-series/fp';
export { default as toCallback } from '@promises/to-callback/fp';
export { default as wait } from '@promises/wait/fp';
9 changes: 9 additions & 0 deletions modules/-prototype/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@promises/-prototype/fp",
"main": "es5.js",
"browser": "umd.min.js",
"module": "index.js",
"es2015": "index.js",
"typings": "index.d.ts",
"bundle": "bundle.min.js"
}
16 changes: 16 additions & 0 deletions modules/-series/fp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @module @promises/-series/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/

export { default as everySeries } from '@promises/every-series/fp';
export { default as filterSeries } from '@promises/filter-series/fp';
export { default as forEachSeries } from '@promises/for-each-series/fp';
export { default as forEachRightSeries } from '@promises/for-each-right-series/fp';
export { default as mapSeries } from '@promises/map-series/fp';
export { default as reduceSeries } from '@promises/reduce-series/fp';
export { default as reduceRightSeries } from '@promises/reduce-right-series/fp';
export { default as rejectSeries } from '@promises/reject-series/fp';
export { default as someSeries } from '@promises/some-series/fp';
export { default as timesSeries } from '@promises/times-series/fp';
9 changes: 9 additions & 0 deletions modules/-series/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@promises/-series/fp",
"main": "es5.js",
"browser": "umd.min.js",
"module": "index.js",
"es2015": "index.js",
"typings": "index.d.ts",
"bundle": "bundle.min.js"
}
7 changes: 6 additions & 1 deletion modules/error/fp.ts → modules/error/fp/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/error/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise } from '@promises/interfaces';
import error from './';
import error from '../';

export interface IError {
<R>(newValue: IOptionalPromise<any>, value: IOptionalPromise<R>): Promise<R>;
Expand Down
7 changes: 7 additions & 0 deletions modules/error/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/error/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/every-parallel/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise, IOptionalPromiseDictionary } from '@promises/interfaces';
import everyParallel from './';
import everyParallel from '../';

export interface IEveryParallel {
<T extends ArrayLike<any>>(iteratee: (value: T[keyof T & number], index: number, array: T) => IOptionalPromise<boolean>, limit: number, array: IOptionalPromise<T>): Promise<boolean>;
Expand Down
7 changes: 7 additions & 0 deletions modules/every-parallel/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/every-parallel/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/every-series/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise, IOptionalPromiseDictionary } from '@promises/interfaces';
import everySeries from './';
import everySeries from '../';

export interface IEverySeries {
<T extends ArrayLike<any>>(iteratee: (value: T[keyof T & number], index: number, array: T) => IOptionalPromise<boolean>, array: IOptionalPromise<T>): Promise<boolean>;
Expand Down
7 changes: 7 additions & 0 deletions modules/every-series/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/every-series/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/filter-parallel/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise, IOptionalPromiseDictionary } from '@promises/interfaces';
import filterParallel from './';
import filterParallel from '../';

export interface IFilterParallel {
<T extends ArrayLike<any>>(iteratee: (value: T[keyof T & number], index: number, array: T) => IOptionalPromise<boolean>, limit: number, array: IOptionalPromise<T>): Promise<T>;
Expand Down
7 changes: 7 additions & 0 deletions modules/filter-parallel/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/filter-parallel/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/filter-series/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise, IOptionalPromiseDictionary } from '@promises/interfaces';
import filterSeries from './';
import filterSeries from '../';

export interface IFilterSeries {
<T extends ArrayLike<any>>(iteratee: (value: T[keyof T & number], index: number, array: T) => IOptionalPromise<boolean>, array: IOptionalPromise<T>): Promise<T>;
Expand Down
7 changes: 7 additions & 0 deletions modules/filter-series/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/filter-series/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
7 changes: 6 additions & 1 deletion modules/finally/fp.ts → modules/finally/fp/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/finally/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise } from '@promises/interfaces';
import _finally from './';
import _finally from '../';

export interface IFinally {
<R>(fn: () => IOptionalPromise<any>, promise: IOptionalPromise<R>): Promise<R>;
Expand Down
7 changes: 7 additions & 0 deletions modules/finally/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/finally/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**
* @module @promises/for-each-parallel/fp
* @copyright © 2017 Yisrael Eliav <yisraelx@gmail.com> (https://github.com/yisraelx)
* @license MIT
*/
import _curry from '@promises/_curry';
import { IOptionalPromise, IOptionalPromiseDictionary } from '@promises/interfaces';
import forEachParallel from './';
import forEachParallel from '../';

export interface IForEachParallel {
<T extends ArrayLike<any>>(iteratee: (value: T[keyof T & number], index: number, array: T) => IOptionalPromise<any>, limit: number, array: IOptionalPromise<T>): Promise<T>;
Expand Down
7 changes: 7 additions & 0 deletions modules/for-each-parallel/fp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@promises/for-each-parallel/fp",
"main": "index.js",
"browser": "bundle.umd.js",
"es2015": "index.es6.js",
"typings": "index.d.ts"
}
Loading

0 comments on commit 94bebb3

Please sign in to comment.