Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created June 20, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/7d652fbd9dd3ff79d12079c8c209bfd3 to your computer and use it in GitHub Desktop.
Save tmcw/7d652fbd9dd3ff79d12079c8c209bfd3 to your computer and use it in GitHub Desktop.

destructure

This function destructures with defaults. It should not have any parameter descriptions.

Parameters

Parameter Description
$0 Object (optional, default {})
:---------------------- -------------------------
$0.phoneNumbers (optional, default [])
$0.emailAddresses (optional, default [])
$0.params ...Any
$0.phoneNumbers (optional, default [])
$0.emailAddresses (optional, default [])
$0.params ...Any

destructure

Similar, but with an array

Parameters

Parameter Description
$0 Array
:-------- -----------
$0.a
$0.b
$0.c
$0.a
$0.b
$0.c

Examples

destructure([1, 2, 3])

multiply

This function returns the number one.

Parameters

Parameter Description
a Array<Number> an array of numbers
b

Returns Number numberone

Sink

This is a sink

staticProp

This is a property of the sink.

empty

Is it empty

aGetter

This is a getter method: it should be documented as a property.

constructor

Parameters

Parameter Description
height number the height of the thing
width number the width of the thing

hello

This method says hello

makeABasket

This method returns a basket. The type should not be linked.

Returns Basket a basket

makeASink

This method returns a sink. The type should be linked. It takes a number which should also be linked.

Returns Sink a sink

functionWithRest

This function takes rest params

Parameters

Parameter Description
someParams ...Any

functionWithRestAndType

So does this one, with types

Parameters

Parameter Description
someParams ...number

foo

This is an async method

es6.input

Parameters

Parameter Description
thisIsTheArgument

es6.input

This function returns the number one.

Returns Number numberone

veryImportantTransform

This tests our support of optional parameters in ES6

Parameters

Parameter Description
foo (optional, default 'bar')

iAmProtected

A protected function

iAmPublic

A public function

execute

This is re-exported

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