Skip to content

Latest commit

 

History

History
80 lines (74 loc) · 2.7 KB

mandatory-dependency.md

File metadata and controls

80 lines (74 loc) · 2.7 KB

Mandatory Dependency

A mandatory dependency is:

  • a function that your function calls
  • that your function receives as a parameter from the caller
  • and the parameter has no default value

For example:

// `logger` is a mandatory dependency
// the caller has to provide it
//
// `db` is also a mandatory dependency
// the caller has to provide it as well
function doQuery(logger: Logger, db: DbConn, sql: string): unknown {
    logger.debug("executing query: " + sql);

    return db.query(sql);
}