Skip to content

Instantly share code, notes, and snippets.

@artalar
Last active August 8, 2018 17:02
Show Gist options
  • Select an option

  • Save artalar/10bbdd64422b2b3b022f9fdc2d00f230 to your computer and use it in GitHub Desktop.

Select an option

Save artalar/10bbdd64422b2b3b022f9fdc2d00f230 to your computer and use it in GitHub Desktop.
import * as t from "jsdoc-runtime";
const tSqrt = t.declare.number
// if input will not valid
// return to last (this) workflow node
.default(t.context.fallback(() => 0))
// used in autotests
.from(0)
.to(t.int)
const sqrt = t`
The function returns the square root of a number
@param ${tSqrt} number
@return ${t.context.add({ result: tSqrt.or(t.long) })}
`(number => {
const result = t`${t.context.result}`(Math.sqrt(number));
return result;
});
@artalar

artalar commented Aug 8, 2018

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment