Repository: expo/expo
File: packages/expo-modules-core/ios/Core/Records/Formatter.swift (Swift)

Code before:
    ) -> NextBuilder<ResultType> {
      return chainAction { _, value in mapper(value as! InputType ) }
    }

    @discardableResult func skip() -> NextBuilder<InputType> {
      return chainSkipAction(shouldSkip: { _, _ in true })
    }

    @discardableResult func skip(
      _ valueSelector: @escaping (RecordType, InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainSkipAction(shouldSkip: valueSelector)
    }

    @discardableResult func skip(
      _ valueSelector: @escaping (InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainSkipAction { _, value in valueSelector(value) }
    }

    private func chainAction<NextInputType>(
      nextAction: @escaping (RecordType, Any?) -> Any?
    ) -> NextBuilder<NextInputType> {
      let previouseAction = propertySelector.action
      propertySelector.action = { record, value in
        let previousValue = previouseAction(record, value)
        if previousValue is Skip {
          return Skip.instance
        }

        return nextAction(record, previousValue)
      }

      return PropertySelector.ActionBuilder(selector: propertySelector)
    }

    private func chainSkipAction(
      shouldSkip: @escaping (RecordType, InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainAction { record, value in
        let typedValue = value as! InputType
        if shouldSkip(record, typedValue) {
          return Skip.instance
        }

        return typedValue
      }
    }
  }

  let name: String

Review comment (suggestion):
```suggestion
      let previousAction = propertySelector.action
      propertySelector.action = { record, value in
        let previousValue = previousAction(record, value)
```

Code after:

    @discardableResult
    public func map<ResultType>(
      _ mapper: @escaping ( InputType) -> ResultType
    ) -> NextBuilder<ResultType> {
      return chainAction { _, value in mapper(value as! InputType ) }
    }

    @discardableResult
    public func skip() -> NextBuilder<InputType> {
      return chainSkipAction(shouldSkip: { _, _ in true })
    }

    @discardableResult
    public func skip(
      _ valueSelector: @escaping (RecordType, InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainSkipAction(shouldSkip: valueSelector)
    }

    @discardableResult
    public func skip(
      _ valueSelector: @escaping (InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainSkipAction { _, value in valueSelector(value) }
    }

    private func chainAction<NextInputType>(
      nextAction: @escaping (RecordType, Any?) -> Any?
    ) -> NextBuilder<NextInputType> {
      let previousAction = propertySelector.action
      propertySelector.action = { record, value in
        let previousValue = previousAction(record, value)
        if previousValue is Skip {
          return Skip.instance
        }

        return nextAction(record, previousValue)
      }

      return PropertySelector.ActionBuilder(selector: propertySelector)
    }

    private func chainSkipAction(
      shouldSkip: @escaping (RecordType, InputType) -> Bool
    ) -> NextBuilder<InputType> {
      return chainAction { record, value in
        let typedValue = value as! InputType
        if shouldSkip(record, typedValue) {
          return Skip.instance
        }