change key to 'function'; add 'type' option
initial commit