MCPcopy Create free account
hub / github.com/codecombat/codecombat / normalizeFunc

Function normalizeFunc

app/core/utils.js:570–583  ·  view source on GitHub ↗
(func_thing, object)

Source from the content-addressed store, hash-verified

568}
569
570const normalizeFunc = function (func_thing, object) {
571 // func could be a string to a function in this class
572 // or a function in its own right
573 if (object == null) { object = {} }
574 if (_.isString(func_thing)) {
575 const func = object[func_thing]
576 if (!func) {
577 console.error(`Could not find method ${func_thing} in object`, object)
578 return () => null // always return a func, or Mediator will go boom
579 }
580 func_thing = func
581 }
582 return func_thing
583}
584
585const objectIdToDate = objectID => new Date(parseInt(objectID.toString().slice(0, 8), 16) * 1000)
586

Callers

nothing calls this directly

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected