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
+33
View File
@@ -0,0 +1,33 @@
import { isFunction } from './checks.js'
// does simply nothing
export function noop() {
return this
}
/**
* Autobind the methods of a source object to itself
* @param {object} source - probably a riot tag instance
* @param {Array<string>} methods - list of the methods to autobind
* @returns {object} the original object received
*/
export function autobindMethods(source, methods) {
methods.forEach((method) => {
source[method] = source[method].bind(source)
})
return source
}
/**
* Call the first argument received only if it's a function otherwise return it as it is
* @param {*} source - anything
* @returns {*} anything
*/
export function callOrAssign(source) {
return isFunction(source)
? source.prototype && source.prototype.constructor
? new source()
: source()
: source
}