Skip to content

Commit 9de7b44

Browse files
emmenkoacdlite
authored andcommitted
More JSDoc
1 parent b8308ec commit 9de7b44

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

src/utils/createReduxShape.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* Define the shape of the `redux` prop, used for props validation.
3+
*
4+
* @param {Object} PropTypes
5+
* @return {Object}
6+
*/
17
export default function createReduxShape(PropTypes) {
28
return PropTypes.shape({
39
subscribe: PropTypes.func.isRequired,

src/utils/identity.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* Returns the first argument provided to it.
3+
*
4+
* @param {*} value
5+
* @return {*}
6+
*/
17
export default function identity(value) {
28
return value;
39
}

src/utils/isPlainObject.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Given an object, checks that it's a plain object. That is, an object
3+
* created by the `Object` constructor or one with a `Prototype` of `null`.
4+
*
5+
* @param {*} obj - the value to check
6+
* @return {Boolean} `true` if it's a plain object, else `false`
7+
*/
18
export default function isPlainObject(obj) {
2-
return obj ? typeof obj === 'object' && Object.getPrototypeOf(obj) === Object.prototype : false;
9+
return obj ? typeof obj === 'object'
10+
&& Object.getPrototypeOf(obj) === Object.prototype : false;
311
}

src/utils/mapValues.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Given an object, returns a new object with the same keys
3+
* and values generated by running each own enumerable property
4+
* of the object through an `iteratee` function.
5+
*
6+
* @param {Object} obj
7+
* @param {Function} fn - invoked to map the new value
8+
* @return {Object}
9+
*/
110
export default function mapValues(obj, fn) {
211
return Object.keys(obj).reduce((result, key) => {
312
result[key] = fn(obj[key], key);

src/utils/pick.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* Given an object, returns a new object with the same keys
3+
* and values filtered by the result of the `iteratee` function.
4+
*
5+
* @param {Object} obj
6+
* @param {Function} fn - invoked to determine whether to discard
7+
* the property or not
8+
* @return {Object}
9+
*/
110
export default function pick(obj, fn) {
211
return Object.keys(obj).reduce((result, key) => {
312
if (fn(obj[key])) {

0 commit comments

Comments
 (0)