@@ -2,32 +2,30 @@ import { isObject } from './checks.js'
22
33/**
44 * Helper function to set an immutable property
5- * @param {Object } source - object where the new property will be set
5+ * @param {object } source - object where the new property will be set
66 * @param {string } key - object key where the new property will be stored
77 * @param {* } value - value of the new property
8- * @param {Object } options - set the property overriding the default options
9- * @returns {Object } - the original object modified
8+ * @param {object } options - set the property overriding the default options
9+ * @returns {object } - the original object modified
1010 */
1111export function defineProperty ( source , key , value , options = { } ) {
12- /* eslint-disable fp/no-mutating-methods */
1312 Object . defineProperty ( source , key , {
1413 value,
1514 enumerable : false ,
1615 writable : false ,
1716 configurable : true ,
1817 ...options ,
1918 } )
20- /* eslint-enable fp/no-mutating-methods */
2119
2220 return source
2321}
2422
2523/**
2624 * Define multiple properties on a target object
27- * @param {Object } source - object where the new properties will be set
28- * @param {Object } properties - object containing as key pair the key + value properties
29- * @param {Object } options - set the property overriding the default options
30- * @returns {Object } the original object modified
25+ * @param {object } source - object where the new properties will be set
26+ * @param {object } properties - object containing as key pair the key + value properties
27+ * @param {object } options - set the property overriding the default options
28+ * @returns {object } the original object modified
3129 */
3230export function defineProperties ( source , properties , options ) {
3331 Object . entries ( properties ) . forEach ( ( [ key , value ] ) => {
@@ -39,9 +37,9 @@ export function defineProperties(source, properties, options) {
3937
4038/**
4139 * Define default properties if they don't exist on the source object
42- * @param {Object } source - object that will receive the default properties
43- * @param {Object } defaults - object containing additional optional keys
44- * @returns {Object } the original object received enhanced
40+ * @param {object } source - object that will receive the default properties
41+ * @param {object } defaults - object containing additional optional keys
42+ * @returns {object } the original object received enhanced
4543 */
4644export function defineDefaults ( source , defaults ) {
4745 Object . entries ( defaults ) . forEach ( ( [ key , value ] ) => {
@@ -62,9 +60,9 @@ export function cloneDeep(source) {
6260
6361/**
6462 * Like Array.prototype.filter but for objects
65- * @param {Object } source - target object
66- * @param {Funciton } filter - filter function
67- * @return { Object } filtered source or the original source received
63+ * @param {object } source - target object
64+ * @param {(key: unknown, value: unknown) => boolean } filter - filter function
65+ * @returns { object } filtered source or the original source received
6866 */
6967export function filter ( source , filter ) {
7068 return isObject ( source )
@@ -76,9 +74,9 @@ export function filter(source, filter) {
7674
7775/**
7876 * Generate a new object picking only the properties from a given array
79- * @param {Object } source - target object
77+ * @param {object } source - target object
8078 * @param {Array } keys - list of keys that we want to copy over to the new object
81- * @return { Object } a new object conaining only the keys that we have picked from the keys array list
79+ * @returns { object } a new object conaining only the keys that we have picked from the keys array list
8280 */
8381export function pick ( source , keys ) {
8482 return isObject ( source )
0 commit comments