add hw2
This commit is contained in:
		
							
								
								
									
										57
									
								
								node_modules/ramda/es/groupBy.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								node_modules/ramda/es/groupBy.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| import _checkForMethod from "./internal/_checkForMethod.js"; | ||||
| import _curry2 from "./internal/_curry2.js"; | ||||
| import reduceBy from "./reduceBy.js"; | ||||
| /** | ||||
|  * Splits a list into sub-lists stored in an object, based on the result of | ||||
|  * calling a key-returning function on each element, and grouping the | ||||
|  * results according to values returned. | ||||
|  * | ||||
|  * Dispatches to the `groupBy` method of the second argument, if present. | ||||
|  * | ||||
|  * Acts as a transducer if a transformer is given in list position. | ||||
|  * | ||||
|  * @func | ||||
|  * @memberOf R | ||||
|  * @since v0.1.0 | ||||
|  * @category List | ||||
|  * @typedefn Idx = String | Int | Symbol | ||||
|  * @sig Idx a => (b -> a) -> [b] -> {a: [b]} | ||||
|  * @param {Function} fn Function :: a -> Idx | ||||
|  * @param {Array} list The array to group | ||||
|  * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements | ||||
|  *         that produced that key when passed to `fn`. | ||||
|  * @see R.reduceBy, R.transduce, R.indexBy | ||||
|  * @example | ||||
|  * | ||||
|  *      const byGrade = R.groupBy(function(student) { | ||||
|  *        const score = student.score; | ||||
|  *        return score < 65 ? 'F' : | ||||
|  *               score < 70 ? 'D' : | ||||
|  *               score < 80 ? 'C' : | ||||
|  *               score < 90 ? 'B' : 'A'; | ||||
|  *      }); | ||||
|  *      const students = [{name: 'Abby', score: 84}, | ||||
|  *                      {name: 'Eddy', score: 58}, | ||||
|  *                      // ... | ||||
|  *                      {name: 'Jack', score: 69}]; | ||||
|  *      byGrade(students); | ||||
|  *      // { | ||||
|  *      //   'A': [{name: 'Dianne', score: 99}], | ||||
|  *      //   'B': [{name: 'Abby', score: 84}] | ||||
|  *      //   // ..., | ||||
|  *      //   'F': [{name: 'Eddy', score: 58}] | ||||
|  *      // } | ||||
|  */ | ||||
|  | ||||
| var groupBy = | ||||
| /*#__PURE__*/ | ||||
| _curry2( | ||||
| /*#__PURE__*/ | ||||
| _checkForMethod('groupBy', | ||||
| /*#__PURE__*/ | ||||
| reduceBy(function (acc, item) { | ||||
|   acc.push(item); | ||||
|   return acc; | ||||
| }, []))); | ||||
|  | ||||
| export default groupBy; | ||||
		Reference in New Issue
	
	Block a user
	 nik
					nik