File tree Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Define the shape of the `redux` prop, used for props validation.
3
+ *
4
+ * @param {Object } PropTypes
5
+ * @return {Object }
6
+ */
1
7
export default function createReduxShape ( PropTypes ) {
2
8
return PropTypes . shape ( {
3
9
subscribe : PropTypes . func . isRequired ,
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Returns the first argument provided to it.
3
+ *
4
+ * @param {* } value
5
+ * @return {* }
6
+ */
1
7
export default function identity ( value ) {
2
8
return value ;
3
9
}
Original file line number Diff line number Diff line change
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
+ */
1
8
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 ;
3
11
}
Original file line number Diff line number Diff line change
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
+ */
1
10
export default function mapValues ( obj , fn ) {
2
11
return Object . keys ( obj ) . reduce ( ( result , key ) => {
3
12
result [ key ] = fn ( obj [ key ] , key ) ;
Original file line number Diff line number Diff line change
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
+ */
1
10
export default function pick ( obj , fn ) {
2
11
return Object . keys ( obj ) . reduce ( ( result , key ) => {
3
12
if ( fn ( obj [ key ] ) ) {
You can’t perform that action at this time.
0 commit comments