mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
30 lines
990 B
TypeScript
30 lines
990 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/assoc.js
|
|
|
|
|
|
import _curry3 from './internal/_curry3.js';
|
|
import assocPath from './assocPath.js';
|
|
|
|
/**
|
|
* Makes a shallow clone of an object, setting or overriding the specified
|
|
* property with the given value. Note that this copies and flattens prototype
|
|
* properties onto the new object as well. All non-primitive properties are
|
|
* copied by reference.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.8.0
|
|
* @category Object
|
|
* @typedefn Idx = String | Int
|
|
* @sig Idx -> a -> {k: v} -> {k: v}
|
|
* @param {String|Number} prop The property name to set
|
|
* @param {*} val The new value
|
|
* @param {Object} obj The object to clone
|
|
* @return {Object} A new object equivalent to the original except for the changed property.
|
|
* @see R.dissoc, R.pick
|
|
* @example
|
|
*
|
|
* R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
|
|
*/
|
|
var assoc = _curry3(function assoc(prop, val, obj) { return assocPath([prop], val, obj); });
|
|
export default assoc;
|