Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Adding collection-like mapping to Change. #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrogccom
Copy link

@jrogccom jrogccom commented Mar 1, 2019

Mapping changes can be useful when inspecting and acting on changes without revealing private types to internal or public interfaces.

@onmyway133
Copy link
Owner

@jrogccom Thanks for the PR, added some comments

import Foundation

public extension Change {
public func map<U>(_ transform: (T) throws -> U) rethrows -> Change<U> {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrogccom can we go with 2 spaces ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onmyway133 Absolutely. I'll do it manually, but is there a linter you use?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't configured SwiftLint for this

switch self {
case .delete(let value):
return try .delete(Delete(item: transform(value.item), index: value.index))

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer no empty lines here

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants