Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Make insertIntoList strict-local
Browse files Browse the repository at this point in the history
Summary: It was mutating an argument. Simply added a level of indirection.

Reviewed By: gkz

Differential Revision: D16854301

fbshipit-source-id: d3da0dc84bcef4ff6f643ac0146bdbb6138aa943
  • Loading branch information
mrkev authored and facebook-github-bot committed Aug 30, 2019
1 parent 8473e41 commit db64f93
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/transaction/insertIntoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @flow strict-local
* @emails oncall+draft_js
*/

Expand All @@ -17,10 +17,11 @@ import type {List} from 'immutable';
* Maintain persistence for target list when appending and prepending.
*/
function insertIntoList<T>(
targetList: List<T>,
targetListArg: List<T>,
toInsert: List<T>,
offset: number,
): List<T> {
let targetList = targetListArg;
if (offset === targetList.count()) {
toInsert.forEach(c => {
targetList = targetList.push(c);
Expand Down

0 comments on commit db64f93

Please sign in to comment.