UNPKG

821 Btext/coffeescriptView Raw
1###
2
3Place into ~/.ipso/templates/factory.coffee to access as MissingModule.$save 'factory'
4
5###
6
7
8module.exports.target = (pending, specLocation) ->
9
10 #
11 # opportunity to modify the render target
12 # ---------------------------------------
13 #
14 # * pending.path, pending.filename
15 #
16
17
18module.exports.render = (entity) ->
19
20 #
21 # return a String to be writen to the target
22 #
23
24 body = """
25
26 lastInstance = undefined
27 module.exports = ->
28
29 lastInstance = local =
30
31 """
32
33 body += "\n #{functionName}: ->\n" for functionName of entity.functions
34 body += "\n return api ="
35 body += "\n #{functionName}: local.#{functionName}\n" for functionName of entity.functions
36 body += """
37
38 module.exports._test = -> lastInstance
39
40 """
41
42 return body