swc/bundler/tests/.cache/deno/e6cc48c158de625fb396045db3042a95a705e98b.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

31 lines
1.2 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/modify.js
import _curry3 from './internal/_curry3.js';
import modifyPath from './modifyPath.js';
/**
* Creates a copy of the passed object by applying an `fn` function to the given `prop` property.
*
* The function will not be invoked, and the object will not change
* if its corresponding property does not exist in the object.
* All non-primitive properties are copied to the new object by reference.
*
* @func
* @memberOf R
* @category Object
* @sig Idx -> (v -> v) -> {k: v} -> {k: v}
* @param {String|Number} prop The property to be modified.
* @param {Function} fn The function to apply to the property.
* @param {Object} object The object to be transformed.
* @return {Object} The transformed object.
* @example
*
* const person = {name: 'James', age: 20, pets: ['dog', 'cat']};
* R.modify('age', R.add(1), person); //=> {name: 'James', age: 21, pets: ['dog', 'cat']}
* R.modify('pets', R.append('turtle'), person); //=> {name: 'James', age: 20, pets: ['dog', 'cat', 'turtle']}
*/
var modify = _curry3(function modify(prop, fn, object) { return modifyPath([prop], fn, object); });
export default modify;