draft of javascript partial function