debut des details de la page. Vu que c'est le troisieme (euh quatrieme?) composant, c'etait un peu plus rapide, mais heureusement que claude est la pour repasser derriere mes erreurs prcq en solo je n'y arriverais pas du tout!

This commit is contained in:
camille
2026-03-27 17:49:26 +01:00
parent 24e85c4471
commit 43589e583e
92 changed files with 12959 additions and 0 deletions
Generated Vendored
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Gianluca Guarini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+74
View File
@@ -0,0 +1,74 @@
# cumpa
Minimal function composition implementation
<img alt="cumpa" src="./cumpa.gif" width="50%"/>
> `cumpá` in some Italian :it: dialects means `fellow`
[![Build Status][ci-image]][ci-url]
[![NPM version][npm-version-image]][npm-url]
[![NPM downloads][npm-downloads-image]][npm-url]
[![MIT License][license-image]][license-url]
## Usage
```js
import compose from 'cumpa'
const add2 = x => x + 2
const multiplyBy3 = x => x * 3
const add2AndMultiplyBy3 = compose(multiplyBy3, add2)
console.log(add2AndMultiplyBy3(1)) // ((1 + 2) * 3) = 9
```
[ci-image]: https://img.shields.io/github/actions/workflow/status/gianlucaguarini/cumpa/test.yml?style=flat-square
[ci-url]: https://github.com/gianlucaguarini/cumpa/actions
[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
[license-url]: LICENSE
[npm-version-image]: http://img.shields.io/npm/v/cumpa.svg?style=flat-square
[npm-downloads-image]: http://img.shields.io/npm/dm/cumpa.svg?style=flat-square
[npm-url]: https://npmjs.org/package/cumpa
## API
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
#### Table of Contents
- [composeRight](#composeright)
- [Parameters](#parameters)
- [compose](#compose)
- [Parameters](#parameters-1)
### composeRight
Similar to compose but performs from left-to-right function composition.<br/>
[see also](https://30secondsofcode.org/function#composeright)
#### Parameters
- `fns` **...\[[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)]** ) - list of unary fynctions
Returns **any** result of the computation
### compose
Performs right-to-left function composition.
Use Array.prototype.reduce() to perform right-to-left function composition.
The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
[source code](https://30secondsofcode.org/function#compose)
#### Parameters
- `fns` **...\[[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)]** ) - list of unary fynctions
Returns **any** result of the computation
+32
View File
@@ -0,0 +1,32 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.cumpa = {}));
})(this, (function (exports) { 'use strict';
/**
* Similar to compose but performs from left-to-right function composition.<br/>
* {@link https://30secondsofcode.org/function#composeright see also}
* @param {...[function]} fns) - list of unary function
* @returns {*} result of the computation
*/
const composeRight = (...fns) => compose(...fns.reverse());
/**
* Performs right-to-left function composition.<br/>
* Use Array.prototype.reduce() to perform right-to-left function composition.<br/>
* The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
* {@link https://30secondsofcode.org/function#compose original source code}
* @param {...[function]} fns) - list of unary function
* @returns {*} result of the computation
*/
function compose(...fns) {
return fns.reduce((f, g) => (...args) => f(g(...args)))
}
exports.composeRight = composeRight;
exports.default = compose;
Object.defineProperty(exports, '__esModule', { value: true });
}));
+4
View File
@@ -0,0 +1,4 @@
export declare const composeRight:<T extends (...args:unknown[]) => unknown, U>(...args:T[]) => U
declare const cumpa: <T extends (...args:unknown[]) => unknown, U>(...args:T[]) => U
export default cumpa
+21
View File
@@ -0,0 +1,21 @@
/**
* Similar to compose but performs from left-to-right function composition.<br/>
* {@link https://30secondsofcode.org/function#composeright see also}
* @param {...[function]} fns) - list of unary function
* @returns {*} result of the computation
*/
const composeRight = (...fns) => compose(...fns.reverse());
/**
* Performs right-to-left function composition.<br/>
* Use Array.prototype.reduce() to perform right-to-left function composition.<br/>
* The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
* {@link https://30secondsofcode.org/function#compose original source code}
* @param {...[function]} fns) - list of unary function
* @returns {*} result of the computation
*/
function compose(...fns) {
return fns.reduce((f, g) => (...args) => f(g(...args)))
}
export { composeRight, compose as default };
+50
View File
@@ -0,0 +1,50 @@
{
"name": "cumpa",
"version": "2.0.1",
"type": "module",
"description": "Minimal function composition implementation",
"main": "index.js",
"module": "index.js",
"exports": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
},
"scripts": {
"prepublishOnly": "npm run build && npm test",
"lint": "eslint index.next.js test.js rollup.config.js",
"build": "rollup -c",
"doc": "documentation readme index.next.js -s API",
"test-types": "tsc --noEmit",
"test": "npm run lint && npm run test-types && mocha test.js"
},
"files": [
"index.d.ts",
"index.cjs",
"index.js"
],
"repository": {
"type": "git",
"url": "git+https://github.com/GianlucaGuarini/cumpa.git"
},
"keywords": [
"flowRight",
"functional",
"compose",
"compose-right"
],
"author": "Gianluca Guarini <gianluca.guarini@gmail.com> (http://gianlucaguarini.com)",
"license": "MIT",
"bugs": {
"url": "https://github.com/GianlucaGuarini/cumpa/issues"
},
"homepage": "https://github.com/GianlucaGuarini/cumpa#readme",
"devDependencies": {
"@gianlucaguarini/eslint-config": "^2.0.0",
"eslint": "^8.38.0",
"mocha": "^10.2.0",
"rollup": "^3.20.2",
"rollup-plugin-node-resolve": "^4.0.1",
"typescript": "^5.0.4"
}
}