Skip to content

Commit

Permalink
_assoc utilize R.update
Browse files Browse the repository at this point in the history
  • Loading branch information
Harris-Miller committed Jul 9, 2024
1 parent 5d50bde commit 939dd5f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions source/internal/_assoc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import update from '../update.js';
import _isArray from './_isArray.js';
import _isInteger from './_isInteger.js';

Expand All @@ -15,9 +16,7 @@ import _isInteger from './_isInteger.js';
*/
export default function _assoc(prop, val, obj) {
if (_isInteger(prop) && _isArray(obj)) {
var arr = [].concat(obj);
arr[prop] = val;
return arr;
return update(prop, val, obj);
}

var result = {};
Expand Down

0 comments on commit 939dd5f

Please sign in to comment.