typespeed 2.4.1 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/database.decorator.js +2 -4
  2. package/dist/typespeed.js +4 -1
  3. package/introduction/tsconfig.json +20 -0
  4. package/package.json +2 -4
  5. package/src/database.decorator.ts +2 -4
  6. package/src/typespeed.ts +4 -1
  7. package/app/node_modules/.package-lock.json +0 -134
  8. package/app/node_modules/@types/body-parser/LICENSE +0 -21
  9. package/app/node_modules/@types/body-parser/README.md +0 -16
  10. package/app/node_modules/@types/body-parser/index.d.ts +0 -107
  11. package/app/node_modules/@types/body-parser/package.json +0 -58
  12. package/app/node_modules/@types/connect/LICENSE +0 -21
  13. package/app/node_modules/@types/connect/README.md +0 -16
  14. package/app/node_modules/@types/connect/index.d.ts +0 -93
  15. package/app/node_modules/@types/connect/package.json +0 -32
  16. package/app/node_modules/@types/express/LICENSE +0 -21
  17. package/app/node_modules/@types/express/README.md +0 -16
  18. package/app/node_modules/@types/express/index.d.ts +0 -136
  19. package/app/node_modules/@types/express/package.json +0 -45
  20. package/app/node_modules/@types/express-serve-static-core/LICENSE +0 -21
  21. package/app/node_modules/@types/express-serve-static-core/README.md +0 -16
  22. package/app/node_modules/@types/express-serve-static-core/index.d.ts +0 -1281
  23. package/app/node_modules/@types/express-serve-static-core/package.json +0 -55
  24. package/app/node_modules/@types/mime/LICENSE +0 -21
  25. package/app/node_modules/@types/mime/Mime.d.ts +0 -10
  26. package/app/node_modules/@types/mime/README.md +0 -16
  27. package/app/node_modules/@types/mime/index.d.ts +0 -35
  28. package/app/node_modules/@types/mime/lite.d.ts +0 -7
  29. package/app/node_modules/@types/mime/package.json +0 -29
  30. package/app/node_modules/@types/node/LICENSE +0 -21
  31. package/app/node_modules/@types/node/README.md +0 -16
  32. package/app/node_modules/@types/node/assert/strict.d.ts +0 -8
  33. package/app/node_modules/@types/node/assert.d.ts +0 -961
  34. package/app/node_modules/@types/node/async_hooks.d.ts +0 -518
  35. package/app/node_modules/@types/node/buffer.d.ts +0 -2323
  36. package/app/node_modules/@types/node/child_process.d.ts +0 -1399
  37. package/app/node_modules/@types/node/cluster.d.ts +0 -410
  38. package/app/node_modules/@types/node/console.d.ts +0 -412
  39. package/app/node_modules/@types/node/constants.d.ts +0 -18
  40. package/app/node_modules/@types/node/crypto.d.ts +0 -3973
  41. package/app/node_modules/@types/node/dgram.d.ts +0 -545
  42. package/app/node_modules/@types/node/diagnostics_channel.d.ts +0 -192
  43. package/app/node_modules/@types/node/dns/promises.d.ts +0 -370
  44. package/app/node_modules/@types/node/dns.d.ts +0 -660
  45. package/app/node_modules/@types/node/dom-events.d.ts +0 -126
  46. package/app/node_modules/@types/node/domain.d.ts +0 -170
  47. package/app/node_modules/@types/node/events.d.ts +0 -682
  48. package/app/node_modules/@types/node/fs/promises.d.ts +0 -1159
  49. package/app/node_modules/@types/node/fs.d.ts +0 -3976
  50. package/app/node_modules/@types/node/globals.d.ts +0 -303
  51. package/app/node_modules/@types/node/globals.global.d.ts +0 -1
  52. package/app/node_modules/@types/node/http.d.ts +0 -1714
  53. package/app/node_modules/@types/node/http2.d.ts +0 -2133
  54. package/app/node_modules/@types/node/https.d.ts +0 -542
  55. package/app/node_modules/@types/node/index.d.ts +0 -134
  56. package/app/node_modules/@types/node/inspector.d.ts +0 -2741
  57. package/app/node_modules/@types/node/module.d.ts +0 -115
  58. package/app/node_modules/@types/node/net.d.ts +0 -883
  59. package/app/node_modules/@types/node/os.d.ts +0 -473
  60. package/app/node_modules/@types/node/package.json +0 -237
  61. package/app/node_modules/@types/node/path.d.ts +0 -191
  62. package/app/node_modules/@types/node/perf_hooks.d.ts +0 -625
  63. package/app/node_modules/@types/node/process.d.ts +0 -1488
  64. package/app/node_modules/@types/node/punycode.d.ts +0 -117
  65. package/app/node_modules/@types/node/querystring.d.ts +0 -131
  66. package/app/node_modules/@types/node/readline/promises.d.ts +0 -143
  67. package/app/node_modules/@types/node/readline.d.ts +0 -653
  68. package/app/node_modules/@types/node/repl.d.ts +0 -424
  69. package/app/node_modules/@types/node/stream/consumers.d.ts +0 -12
  70. package/app/node_modules/@types/node/stream/promises.d.ts +0 -42
  71. package/app/node_modules/@types/node/stream/web.d.ts +0 -330
  72. package/app/node_modules/@types/node/stream.d.ts +0 -1440
  73. package/app/node_modules/@types/node/string_decoder.d.ts +0 -67
  74. package/app/node_modules/@types/node/test.d.ts +0 -783
  75. package/app/node_modules/@types/node/timers/promises.d.ts +0 -93
  76. package/app/node_modules/@types/node/timers.d.ts +0 -101
  77. package/app/node_modules/@types/node/tls.d.ts +0 -1111
  78. package/app/node_modules/@types/node/trace_events.d.ts +0 -171
  79. package/app/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  80. package/app/node_modules/@types/node/ts4.8/assert.d.ts +0 -961
  81. package/app/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -518
  82. package/app/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2323
  83. package/app/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1399
  84. package/app/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
  85. package/app/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  86. package/app/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
  87. package/app/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3972
  88. package/app/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
  89. package/app/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -192
  90. package/app/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
  91. package/app/node_modules/@types/node/ts4.8/dns.d.ts +0 -660
  92. package/app/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
  93. package/app/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  94. package/app/node_modules/@types/node/ts4.8/events.d.ts +0 -682
  95. package/app/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1138
  96. package/app/node_modules/@types/node/ts4.8/fs.d.ts +0 -3875
  97. package/app/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
  98. package/app/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  99. package/app/node_modules/@types/node/ts4.8/http.d.ts +0 -1651
  100. package/app/node_modules/@types/node/ts4.8/http2.d.ts +0 -2133
  101. package/app/node_modules/@types/node/ts4.8/https.d.ts +0 -542
  102. package/app/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  103. package/app/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2741
  104. package/app/node_modules/@types/node/ts4.8/module.d.ts +0 -115
  105. package/app/node_modules/@types/node/ts4.8/net.d.ts +0 -883
  106. package/app/node_modules/@types/node/ts4.8/os.d.ts +0 -473
  107. package/app/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  108. package/app/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -625
  109. package/app/node_modules/@types/node/ts4.8/process.d.ts +0 -1488
  110. package/app/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  111. package/app/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
  112. package/app/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -143
  113. package/app/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
  114. package/app/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
  115. package/app/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  116. package/app/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
  117. package/app/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
  118. package/app/node_modules/@types/node/ts4.8/stream.d.ts +0 -1440
  119. package/app/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  120. package/app/node_modules/@types/node/ts4.8/test.d.ts +0 -784
  121. package/app/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  122. package/app/node_modules/@types/node/ts4.8/timers.d.ts +0 -94
  123. package/app/node_modules/@types/node/ts4.8/tls.d.ts +0 -1111
  124. package/app/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -171
  125. package/app/node_modules/@types/node/ts4.8/tty.d.ts +0 -206
  126. package/app/node_modules/@types/node/ts4.8/url.d.ts +0 -902
  127. package/app/node_modules/@types/node/ts4.8/util.d.ts +0 -2017
  128. package/app/node_modules/@types/node/ts4.8/v8.d.ts +0 -541
  129. package/app/node_modules/@types/node/ts4.8/vm.d.ts +0 -644
  130. package/app/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  131. package/app/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -695
  132. package/app/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  133. package/app/node_modules/@types/node/tty.d.ts +0 -206
  134. package/app/node_modules/@types/node/url.d.ts +0 -902
  135. package/app/node_modules/@types/node/util.d.ts +0 -2017
  136. package/app/node_modules/@types/node/v8.d.ts +0 -541
  137. package/app/node_modules/@types/node/vm.d.ts +0 -644
  138. package/app/node_modules/@types/node/wasi.d.ts +0 -158
  139. package/app/node_modules/@types/node/worker_threads.d.ts +0 -695
  140. package/app/node_modules/@types/node/zlib.d.ts +0 -517
  141. package/app/node_modules/@types/qs/LICENSE +0 -21
  142. package/app/node_modules/@types/qs/README.md +0 -16
  143. package/app/node_modules/@types/qs/index.d.ts +0 -62
  144. package/app/node_modules/@types/qs/package.json +0 -65
  145. package/app/node_modules/@types/range-parser/LICENSE +0 -21
  146. package/app/node_modules/@types/range-parser/README.md +0 -55
  147. package/app/node_modules/@types/range-parser/index.d.ts +0 -35
  148. package/app/node_modules/@types/range-parser/package.json +0 -25
  149. package/app/node_modules/@types/send/LICENSE +0 -21
  150. package/app/node_modules/@types/send/README.md +0 -16
  151. package/app/node_modules/@types/send/index.d.ts +0 -231
  152. package/app/node_modules/@types/send/package.json +0 -33
  153. package/app/node_modules/@types/serve-static/LICENSE +0 -21
  154. package/app/node_modules/@types/serve-static/README.md +0 -16
  155. package/app/node_modules/@types/serve-static/index.d.ts +0 -113
  156. package/app/node_modules/@types/serve-static/package.json +0 -38
  157. package/app/node_modules/colors/LICENSE +0 -25
  158. package/app/node_modules/colors/README.md +0 -221
  159. package/app/node_modules/colors/examples/normal-usage.js +0 -82
  160. package/app/node_modules/colors/examples/safe-string.js +0 -79
  161. package/app/node_modules/colors/index.d.ts +0 -136
  162. package/app/node_modules/colors/lib/colors.js +0 -211
  163. package/app/node_modules/colors/lib/custom/trap.js +0 -46
  164. package/app/node_modules/colors/lib/custom/zalgo.js +0 -110
  165. package/app/node_modules/colors/lib/extendStringPrototype.js +0 -110
  166. package/app/node_modules/colors/lib/index.js +0 -13
  167. package/app/node_modules/colors/lib/maps/america.js +0 -10
  168. package/app/node_modules/colors/lib/maps/rainbow.js +0 -12
  169. package/app/node_modules/colors/lib/maps/random.js +0 -11
  170. package/app/node_modules/colors/lib/maps/zebra.js +0 -5
  171. package/app/node_modules/colors/lib/styles.js +0 -95
  172. package/app/node_modules/colors/lib/system/has-flag.js +0 -35
  173. package/app/node_modules/colors/lib/system/supports-colors.js +0 -151
  174. package/app/node_modules/colors/package.json +0 -45
  175. package/app/node_modules/colors/safe.d.ts +0 -48
  176. package/app/node_modules/colors/safe.js +0 -10
  177. package/app/node_modules/colors/themes/generic-logging.js +0 -12
  178. package/app/node_modules/dateformat/LICENSE +0 -20
  179. package/app/node_modules/dateformat/Readme.md +0 -204
  180. package/app/node_modules/dateformat/lib/dateformat.js +0 -1
  181. package/app/node_modules/dateformat/package.json +0 -38
  182. package/app/node_modules/mkdirp/CHANGELOG.md +0 -15
  183. package/app/node_modules/mkdirp/LICENSE +0 -21
  184. package/app/node_modules/mkdirp/bin/cmd.js +0 -68
  185. package/app/node_modules/mkdirp/index.js +0 -31
  186. package/app/node_modules/mkdirp/lib/find-made.js +0 -29
  187. package/app/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
  188. package/app/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
  189. package/app/node_modules/mkdirp/lib/opts-arg.js +0 -23
  190. package/app/node_modules/mkdirp/lib/path-arg.js +0 -29
  191. package/app/node_modules/mkdirp/lib/use-native.js +0 -10
  192. package/app/node_modules/mkdirp/package.json +0 -44
  193. package/app/node_modules/mkdirp/readme.markdown +0 -266
  194. package/app/node_modules/tinytim/.travis.yml +0 -5
  195. package/app/node_modules/tinytim/README.md +0 -212
  196. package/app/node_modules/tinytim/index.js +0 -1
  197. package/app/node_modules/tinytim/lib/index.js +0 -55
  198. package/app/node_modules/tinytim/lib/tinytim.js +0 -50
  199. package/app/node_modules/tinytim/package.json +0 -24
  200. package/app/node_modules/tinytim/test/files/html.tim +0 -1
  201. package/app/node_modules/tinytim/test/files/string.tim +0 -1
  202. package/app/node_modules/tinytim/test/files/string2.tim +0 -1
  203. package/app/node_modules/tinytim/test/render-file-replace.js +0 -39
  204. package/app/node_modules/tinytim/test/render-replace.js +0 -94
  205. package/app/node_modules/tinytim/test/tim-replace.js +0 -95
  206. package/app/node_modules/tracer/README.md +0 -747
  207. package/app/node_modules/tracer/lib/color_console.js +0 -15
  208. package/app/node_modules/tracer/lib/console.js +0 -165
  209. package/app/node_modules/tracer/lib/dailyfile.js +0 -92
  210. package/app/node_modules/tracer/lib/index.js +0 -10
  211. package/app/node_modules/tracer/lib/settings.js +0 -25
  212. package/app/node_modules/tracer/lib/utils.js +0 -58
  213. package/app/node_modules/tracer/package.json +0 -53
  214. package/app/node_modules/tracer/types/index.d.ts +0 -189
@@ -1,212 +0,0 @@
1
- #tinytim for node.js [![Build Status](https://secure.travis-ci.org/baryon/node-tinytim.png)](http://travis-ci.org/baryon/node-tinytim)
2
-
3
- Node.js port of [tinytim](https://github.com/premasagar/tim/) (A tiny, secure JavaScript micro-templating script)
4
-
5
-
6
- ##Install
7
- -----
8
- ```javascript
9
- npm install tinytim
10
- ```
11
-
12
- Usage
13
- -----
14
- Add to your code:
15
-
16
- ```javascript
17
- var tim = require('tinytim').tim;
18
- var result = tim("Hello {{place}}", {place: "world"});
19
- console.log(result); // Hello world
20
- ```
21
-
22
- See [test/tim-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/tim-replace.js) as example
23
-
24
- and support render and renderFile methods.
25
- See [test/render-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/render-replace.js) and [test/render-file-replace.js](https://github.com/baryon/node-tinytim/blob/master/test/render-file-replace.js) for details.
26
-
27
- ```javascript
28
- var tinytim = require('tinytim');
29
- var result = tinytim.render("Hello {{place}}", {place: "world"});
30
- console.log(result); // Hello world
31
- ```
32
-
33
- ```javascript
34
- var tinytim = require('tinytim');
35
- var result1 = tinytim.renderFile("./hello.tim", {place: "world"});
36
- console.log(result1); // Hello world
37
-
38
- var result2 = tinytim.renderFile("./hello.tim", {place: "world"}, true); //use cache to render
39
- console.log(result2); // Hello world
40
- ```
41
-
42
-
43
- # Tim
44
-
45
- A tiny, secure JavaScript micro-templating script.
46
-
47
- Tim lets you write simple templates that uses JavaScript's familiar dot notation. You pass in a JavaScript object that contains all the relevant strings, and they are then substituted into the template. For example:
48
-
49
- tim("Hello {{place}}", {place: "world"});
50
- // "Hello world"
51
-
52
- * by [Premasagar Rose](http://premasagar.com)
53
- ([Dharmafly](http://dharmafly.com))
54
- * source: [github.com/premasagar/tim](http://github.com/premasagar/tim) ([MIT license](http://opensource.org/licenses/mit-license.php))
55
- * ~200 bytes minified & gzipped
56
-
57
-
58
- ## Why is micro-templating useful?
59
- Don't you just hate having to write HTML with a mess of string concatenation that clutters up your JavaScript?:
60
-
61
- var myHTML = "<ul class='" + myClass + "'>" +
62
- "<li id='" + theId + "'>" + liContents + "</li>" +
63
- // etc, etc, etc
64
-
65
- Yuck. There's no need to do this. Simply prepare a JavaScript object with the required properties, and inject it into a simple template string. The templates can all be tidily kept together with the rest of the markup in an HTML document (see below).
66
-
67
-
68
- ## How is Tim different from other templating scripts?
69
- It is safe and secure: it doesn't use eval or (new Function), so it cannot execute malicious code. As such, it can be used in secure widgets and apps that disallow eval - e.g. Adobe Air sandboxes, AdSafe ads, etc.
70
-
71
- It doesn't include a whole bloat load of features that are unlikely to get used when you just want to get some simple templating up and running.
72
-
73
- It comes in two versions: "tinytim.js" (<200kb), and "standard", which has advanced functionality and allows extensibility with plugins.
74
-
75
- It's easy to debug.
76
-
77
- For these reasons, it is now in use in Sqwidget, the JavaScript widget library: [github.com/premasagar/sqwidget](http://github.com/premasagar/sqwidget)
78
-
79
-
80
- ## Tim & tinytim.js: Core Functionality
81
- There are two versions of Tim: the "standard" (full) version, and a stripped down "tinytim.js" version. The core functionality of both versions is identical, and is described below.
82
-
83
-
84
- Tim can be used to replace tokens within a text string with specified data.
85
-
86
- For example:
87
-
88
- var template = "Hello {{place}}. My name is {{person.name}}.",
89
- data = {
90
- place: "Brighton",
91
- person: {
92
- name: "Prem"
93
- }
94
- };
95
-
96
- tim(template, data);
97
- // "Hello Brighton. My name is Prem."
98
-
99
-
100
- In addition to plain and simple text, you can use Tim to populate HTML or other types of template.
101
-
102
- For example:
103
-
104
- var template = "<p><a href='{{url}}'>{{title}}</a></p>",
105
- data = {
106
- title: "Dharmafly",
107
- url: "http://dharmafly.com"
108
- };
109
-
110
- tim(myTemplate, data);
111
- // "<p><a href='http://dharmafly.com'>Dharmafly</a></p>"
112
-
113
- ...and so on, all the way up to a full-blown HTML document.
114
-
115
-
116
- ### Nested templates
117
- Sometimes, you will want to reuse the same template multiple times in a loop, and then wrapped within a bigger template - e.g. when creating an HTML `<ul>` list tag.
118
-
119
- This is easily achieved:
120
-
121
- var ul = "<ul>{{list}}</ul>",
122
- li = "<li>{{contents}}</li>",
123
- myList = "",
124
- i;
125
-
126
- for (i=100; i<103; i++){
127
- myList += tim(li, {contents: i});
128
- }
129
- tim(ul, {list: myList});
130
- // "<ul><li>100</li><li>101</li><li>102</li></ul>"
131
-
132
-
133
- ### Debugging
134
- If your template references a path in the data object that could not actually be found, then Tim will throw an error, to help with debugging:
135
-
136
- tim("Hello {{config.foo.bar}}", {config: {moo: "blah"}});
137
- // tim: 'foo' not found in {{config.foo.bar}}
138
-
139
-
140
- ### Using arrays
141
- The data can be, or can include, an array. Use dot notation to access the array elements.
142
-
143
- e.g:
144
-
145
- tim("Hello {{0}}", ["world"]);
146
- // "Hello world"
147
-
148
- or:
149
-
150
- tim("Hello {{places.0}}", {places: ["world"]});
151
- // "Hello world"
152
-
153
- Further examples are discussed in the section "iterating through arrays" below.
154
-
155
-
156
- ### Changing the {{curly braces}} delimiter
157
- By default, template tags are delimited by "`{{`" and "`}}`" tokens.
158
- To change this, edit the `start` and `end` vars in the code.
159
- *** this will affect all module use tinytim, because node.js cache this package.
160
-
161
- ```javascript
162
- var tinytim = require('tinytim');
163
- tinytim.start = "<%";
164
- tinytim.end = "%>";
165
- var result = tinytim.tim("Hello <%place%>", {place: "world"});
166
- console.log(result); // Hello world
167
- ```
168
-
169
- # mustache.js and Handlebars.js
170
- tinytim is very simple, if you need a more powerful template library, see [mustache.js](http://mustache.github.com/) and [Handlebars.js](https://github.com/wycats/handlebars.js/)
171
-
172
-
173
- ## History
174
-
175
- ### 0.1.0
176
-
177
- * support render and renderFile methods.
178
-
179
- ### 0.0.2
180
-
181
- * throw an new Error when not found.
182
-
183
- ### 0.0.1
184
-
185
- * Initial port.
186
-
187
- ## License
188
-
189
- (The MIT License)
190
-
191
- Copyright (c) Premasagar Rose &lt;p@dharmafly.com&gt;
192
-
193
- Copyright (c) 2012 LI Long &lt;lilong@gmail.com&gt;
194
-
195
- Permission is hereby granted, free of charge, to any person obtaining
196
- a copy of this software and associated documentation files (the
197
- 'Software'), to deal in the Software without restriction, including
198
- without limitation the rights to use, copy, modify, merge, publish,
199
- distribute, sublicense, and/or sell copies of the Software, and to
200
- permit persons to whom the Software is furnished to do so, subject to
201
- the following conditions:
202
-
203
- The above copyright notice and this permission notice shall be
204
- included in all copies or substantial portions of the Software.
205
-
206
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
207
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
209
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
210
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
211
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
212
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1 +0,0 @@
1
- module.exports = require("./lib/index")
@@ -1,55 +0,0 @@
1
- module.exports = require('./tinytim');
2
-
3
- /**
4
- * Intermediate js cache.
5
- *
6
- * @type Object
7
- */
8
-
9
- var cache = {};
10
-
11
- /**
12
- * Clear intermediate js cache.
13
- *
14
- * @api public
15
- */
16
-
17
- module.exports.clearCache = function() {
18
- cache = {};
19
- };
20
-
21
- /**
22
- * Render the given `str` of tim.
23
- *
24
- * @param {String}
25
- * str
26
- * @param {Object}
27
- * vars
28
- * @return {String}
29
- * @api public
30
- */
31
-
32
- module.exports.render = module.exports.tim;
33
-
34
-
35
- /**
36
- * Render an tim file at the given `path`.
37
- *
38
- * @param {String}
39
- * path
40
- * @param {Vars}
41
- * vars
42
- * @param {Bool}
43
- * use cache or not
44
- * @api public
45
- */
46
-
47
- module.exports.renderFile = function(path, vars, useCache) {
48
- var fs = require('fs');
49
- var key = path + ':string';
50
- var str = useCache ? cache[key]
51
- || (cache[key] = fs.readFileSync(path, 'utf8')) : fs
52
- .readFileSync(path, 'utf8');
53
-
54
- return module.exports.render(str, vars);
55
- };
@@ -1,50 +0,0 @@
1
- /*!
2
- tinytim.js
3
- github.com/premasagar/tim
4
- A tiny, secure JavaScript micro-templating script.
5
- by Premasagar Rose
6
- dharmafly.com
7
- license
8
- opensource.org/licenses/mit-license.php
9
- creates global object
10
- tim
11
- v0.3.0
12
-
13
- ported and modified by LI Long <lilong@gmail.com> 3/13/2012
14
- */
15
- var start = exports.start = "{{";
16
- var end = exports.end = "}}";
17
-
18
- var tim = exports.tim = (function(){
19
- "use strict";
20
-
21
- var
22
- path = "[a-z0-9_][\\.a-z0-9_]*", // e.g. config.person.name
23
- undef;
24
-
25
- return function(template, data){
26
- var pattern = new RegExp(exports.start + "\\s*("+ path +")\\s*" + exports.end, "gi");
27
-
28
- // Merge data into the template string
29
- return template.replace(pattern, function(tag, token){
30
- var path = token.split("."),
31
- len = path.length,
32
- lookup = data,
33
- i = 0;
34
-
35
- for (; i < len; i++){
36
- lookup = lookup[path[i]];
37
-
38
- // Property not found
39
- if (lookup === undef){
40
- throw new Error("tim: '" + path[i] + "' not found in " + tag);
41
- }
42
-
43
- // Return the required value
44
- if (i === len - 1){
45
- return lookup;
46
- }
47
- }
48
- });
49
- };
50
- }());
@@ -1,24 +0,0 @@
1
- {
2
- "name": "tinytim",
3
- "description": "Node.js port of tinytim (A tiny, secure JavaScript micro-templating script)",
4
- "homepage": "http://github.com/baryon/node-tinytim",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/baryon/node-tinytim"
8
- },
9
- "version": "0.1.1",
10
- "author": "LI Long <lilong@gmail.com>",
11
- "license": "MIT",
12
- "contributors": [
13
- { "name": "Premasagar Rose", "email": "p@dharmafly.com" }
14
- ],
15
- "dependencies": {
16
- },
17
- "devDependencies": {
18
- "mocha": "1.20.x"
19
- },
20
- "main": "./lib/index",
21
- "keywords": ["template", "micro template", "tim"],
22
- "scripts": { "test": "mocha test/*" },
23
- "engines": { "node": ">= 0.2.0" }
24
- }
@@ -1 +0,0 @@
1
- <p><a href='{{url}}'>{{title}}</a></p>
@@ -1 +0,0 @@
1
- Hello {{place}}
@@ -1 +0,0 @@
1
- Hello {{place}}. My name is {{person.name}}.
@@ -1,39 +0,0 @@
1
- var assert = require('assert'),
2
- tinytim = require('../'),
3
- tim = tinytim.tim;
4
-
5
- describe('Render File tests', function () {
6
-
7
- it('file replace on simple string', function (done) {
8
- var result = tinytim.renderFile("test/files/string.tim", {place: "world"});
9
- assert.equal(result, "Hello world");
10
- done();
11
- });
12
-
13
- it('file path replace on simple string', function (done) {
14
- var template = "test/files/string2.tim",
15
- data = {
16
- place: "Brighton",
17
- person: {
18
- name: "Prem"
19
- }
20
- };
21
-
22
- var result = tinytim.renderFile(template, data);
23
- assert.equal(result, "Hello Brighton. My name is Prem.");
24
- done();
25
- });
26
-
27
- it('file replace on html string', function (done) {
28
- var template = "test/files/html.tim",
29
- data = {
30
- title: "Dharmafly",
31
- url: "http://dharmafly.com"
32
- };
33
-
34
- var result = tinytim.renderFile(template, data);
35
- assert.equal(result, "<p><a href='http://dharmafly.com'>Dharmafly</a></p>");
36
- done();
37
- });
38
-
39
- });
@@ -1,94 +0,0 @@
1
- var assert = require('assert'),
2
- tinytim = require('../'),
3
- tim = tinytim.tim;
4
-
5
- describe('Render inline tests', function () {
6
-
7
- it('inline replace on simple string', function (done) {
8
- var result = tinytim.render("Hello {{place}}", {place: "world"});
9
- assert.equal(result, "Hello world");
10
- done();
11
- });
12
-
13
- it('Render inline path replace on simple string', function (done) {
14
- var template = "Hello {{place}}. My name is {{person.name}}.",
15
- data = {
16
- place: "Brighton",
17
- person: {
18
- name: "Prem"
19
- }
20
- };
21
-
22
- var result = tim(template, data);
23
- assert.equal(result, "Hello Brighton. My name is Prem.");
24
- done();
25
- });
26
-
27
- it('Render inline replace on html string', function (done) {
28
- var template = "<p><a href='{{url}}'>{{title}}</a></p>",
29
- data = {
30
- title: "Dharmafly",
31
- url: "http://dharmafly.com"
32
- };
33
-
34
- var result = tinytim.render(template, data);
35
- assert.equal(result, "<p><a href='http://dharmafly.com'>Dharmafly</a></p>");
36
- done();
37
- });
38
-
39
- it('Render inline replace on nested object', function (done) {
40
- var ul = "<ul>{{list}}</ul>",
41
- li = "<li>{{contents}}</li>",
42
- myList = "",
43
- i;
44
-
45
- for (i = 100; i < 103; i++) {
46
- myList += tinytim.render(li, {contents: i});
47
- }
48
- var result = tinytim.render(ul, {list: myList});
49
- assert.equal(result, "<ul><li>100</li><li>101</li><li>102</li></ul>");
50
-
51
- done();
52
- });
53
-
54
- it('Render inline replace using simple array', function (done) {
55
-
56
- var result = tinytim.render("Hello {{0}}", ["world"]);
57
- assert.equal(result, "Hello world");
58
-
59
- done();
60
- });
61
-
62
- it('Render inline replace using object arrays', function (done) {
63
-
64
- var result = tinytim.render("Hello {{places.0}}", {places: ["world"]});
65
- assert.equal(result, "Hello world");
66
-
67
- done();
68
- });
69
-
70
- it('Render throws exception if path is invalid', function (done) {
71
-
72
- assert.throws(function () {
73
- var result = tinytim.render("Hello {{config.foo.bar}}", {config: {moo: "blah"}});
74
- }, Error);
75
-
76
- done();
77
- });
78
-
79
- it('Render using non-standard template delimiters endings: `<%` and `%>`', function (done) {
80
- var tinytim = require('../');
81
-
82
- tinytim.start = "<%";
83
- tinytim.end = "%>";
84
-
85
- var result = tinytim.render("Hello <%place%>", {place: "world"});
86
- assert.equal(result, "Hello world");
87
-
88
- tinytim.start = "{{";
89
- tinytim.end = "}}";
90
-
91
- done();
92
- });
93
-
94
- });
@@ -1,95 +0,0 @@
1
- var assert = require('assert'),
2
- tinytim = require('../'),
3
- tim = tinytim.tim;
4
-
5
- describe('String inline tests', function () {
6
-
7
- it('inline replace on simple string', function (done) {
8
-
9
- var result = tim("Hello {{place}}", {place: "world"});
10
- console.log(result);
11
- assert.equal(result, "Hello world");
12
- done();
13
- });
14
-
15
- it('inline path replace on simple string', function (done) {
16
- var template = "Hello {{place}}. My name is {{person.name}}.",
17
- data = {
18
- place: "Brighton",
19
- person: {
20
- name: "Prem"
21
- }
22
- };
23
-
24
- var result = tim(template, data);
25
- assert.equal(result, "Hello Brighton. My name is Prem.");
26
-
27
- done();
28
- });
29
-
30
- it('inline replace on html string', function (done) {
31
- var template = "<p><a href='{{url}}'>{{title}}</a></p>",
32
- data = {
33
- title: "Dharmafly",
34
- url: "http://dharmafly.com"
35
- };
36
-
37
- var result = tim(template, data);
38
- assert.equal(result, "<p><a href='http://dharmafly.com'>Dharmafly</a></p>");
39
-
40
- done();
41
- });
42
-
43
- it('inline replace on nested object', function (done) {
44
- var ul = "<ul>{{list}}</ul>",
45
- li = "<li>{{contents}}</li>",
46
- myList = "",
47
- i;
48
-
49
- for (i = 100; i < 103; i++) {
50
- myList += tim(li, {contents: i});
51
- }
52
- var result = tim(ul, {list: myList});
53
- assert.equal(result, "<ul><li>100</li><li>101</li><li>102</li></ul>");
54
-
55
- done();
56
- });
57
-
58
- it('inline replace using simple array', function (done) {
59
-
60
- var result = tim("Hello {{0}}", ["world"]);
61
- assert.equal(result, "Hello world");
62
-
63
- done();
64
- });
65
-
66
- it('inline replace using object arrays', function (done) {
67
-
68
- var result = tim("Hello {{places.0}}", {places: ["world"]});
69
- assert.equal(result, "Hello world");
70
-
71
- done();
72
- });
73
-
74
- it('throws exception if path is invalid', function (done) {
75
-
76
- assert.throws(function () {
77
- var result = tim("Hello {{config.foo.bar}}", {config: {moo: "blah"}});
78
- }, Error);
79
-
80
- done();
81
- });
82
-
83
- it('using non-standard template delimiters endings: `<%` and `%>`', function (done) {
84
- var tinytim = require('../');
85
-
86
- tinytim.start = "<%";
87
- tinytim.end = "%>";
88
-
89
- var result = tinytim.tim("Hello <%place%>", {place: "world"});
90
- assert.equal(result, "Hello world");
91
-
92
- done();
93
- });
94
-
95
- });