packages/shared/util/Recoil_shallowArrayEqual.js (19 lines of code) (raw):

/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails oncall+recoil * @flow strict * @format */ 'use strict'; function shallowArrayEqual<TArr: $ReadOnlyArray<mixed>>( a: TArr, b: TArr, ): boolean { if (a === b) { return true; } if (a.length !== b.length) { return false; } for (let i = 0, l = a.length; i < l; i++) { if (a[i] !== b[i]) { return false; } } return true; } module.exports = shallowArrayEqual;