Skip to content

Commit

Permalink
chore: move all commands into commands directory
Browse files Browse the repository at this point in the history
BREAKING CHANGE: change of import structure
  • Loading branch information
DarcyRayner committed Mar 2, 2019
1 parent 44befcb commit d311920
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandQueue } from './command-queue';
import { CommandQueue } from '../command-queue';
import {
interruptable,
waitForSeconds,
Expand All @@ -14,8 +14,8 @@ import {
defer,
consumeTime,
dilateTime
} from './commands';
import { smooth } from './ease';
} from './common';
import { smooth } from '../ease';

describe('interruptable', () => {
it('will call the interrupt handler on fast foward of in progress command', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/commands.ts → src/core/commands/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Ease } from './ease';
import { Ease } from '../ease';

export enum CommandOperation {
Normal,
Expand Down
2 changes: 1 addition & 1 deletion src/core/commands/functional.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommandQueue } from '../command-queue';
import { mapParallel, mapSequential } from './functional';
import { sequence, waitForSeconds } from '../commands';
import { sequence, waitForSeconds } from './common';

describe('mapParallel', () => {
it('executes all generated commands in parallel', () => {
Expand Down
12 changes: 11 additions & 1 deletion src/core/commands/functional.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { CommandFactory, Command, parallel, sequence } from '../commands';
import { Command, parallel, sequence } from './common';

/**
* Maps a collection of values to a series of commands run in parallel.
* @param items The collection of items
* @param factory A factory function which converts each item to a command
*/
export function mapParallel<T>(items: Iterable<T>, factory: (item: T, index: number) => Command | undefined): Command {
return parallel(...mapToCommands(items, factory));
}

/**
* Maps a collection of values to a series of commands run sequentially.
* @param items The collection of items
* @param factory A factory function which converts each item to a command
*/
export function mapSequential<T>(
items: Iterable<T>,
factory: (item: T, index: number) => Command | undefined
Expand Down
4 changes: 4 additions & 0 deletions src/core/commands/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './functional';
export * from './number';
export * from './object';
export * from './common';

0 comments on commit d311920

Please # to comment.