-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grid): various changes, mainly traverse() and update() methods
With the transduce() function as the main way of traversing/updating hexes, Grid's traverse() and update() are convenience methods that internally use transduce(). The added value of grid.traverse() is that it returns hexes limited to those present in the grid. The added value of grid.update() is that it always "merges" transformed hexes (optionally supplied by a traverser or iterable) into the grid. It also automatically limits hexes to those present in the grid (passed transformers are only called with existing hexes). Finally, the way a grid is created is improved. The constructor now also accepts a grid (which will be cloned) or an iterable of hex coordinates.
- Loading branch information
1 parent
efd9c2e
commit a79be39
Showing
2 changed files
with
89 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// copied from https://github.com/dphilipson/transducist/blob/master/src/propertyNames.ts | ||
export const INIT = '@@transducer/init' | ||
export const RESULT = '@@transducer/result' | ||
export const STEP = '@@transducer/step' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters