Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

Commit 7ff1fa6

Browse files
committed
merge complete
2 parents 72bb42a + 6beede6 commit 7ff1fa6

9 files changed

Lines changed: 410 additions & 425 deletions

File tree

BUILD/BUILD.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ for(var module in fuMethods){
141141
docs.formatFu += ( '<li>' + fM[method] + '</li>');
142142
break;
143143
case 'to':
144-
docs.toFu += ( '<li>' + fM[method] + '</li>');
144+
if(fM[method]!='token'){
145+
docs.toFu += ( '<li>' + fM[method] + '</li>');
146+
}
145147
break;
146148
default:
147149
//sys.puts('didnt find shit');

BUILD/dateTime.js

Lines changed: 80 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,91 @@
1-
dateTimeFu adds a new method "format" to the baked in JavaScript date object
1+
<a href = "#">Try out the interactive demo of Date.format()</a>
22

3+
dateTimeFu adds a new method "format" to the built in JavaScript Date object
34

4-
format() takes one argument, a formatting mask
5-
you can use some of the built in formatting masks such as ""
5+
Date.format() takes one argument, a formatting mask<br/>
6+
you can use a pre-defined formatting mask or an inline mask. you can also define new re-usable masks
67

7-
// create a new Date (which will return the the current date and time)
8-
var now = new Date();
8+
var now = new Date();
9+
now.format("shortDate"); // ouputs: 7/1/10
10+
now.format("mm/dd/yyyy"); // outputs: 07/01/2010
911

10-
this will return the value of "Tue May 25 2010 22:59:09 GMT-0400 (EST)"
1112

12-
13-
now that we have a DateTime object with the current date and time, we can format it
13+
<h3>pre-defined dateTime masks</h3>
1414

15-
now.format("m/dd/yy");
16-
// Returns, e.g., 6/09/07
17-
18-
// Can also be used as a standalone function
19-
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
20-
// Saturday, June 9th, 2007, 5:46:21 PM
21-
22-
// You can use one of several named masks
23-
now.format("isoDateTime");
24-
// 2007-06-09T17:46:21
25-
26-
// ...Or add your own
27-
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
28-
now.format("hammerTime");
29-
// 17:46! Can't touch this!
30-
31-
// When using the standalone dateFormat function,
32-
// you can also provide the date as a string
33-
dateFormat("Jun 9 2007", "fullDate");
34-
// Saturday, June 9, 2007
35-
36-
// Note that if you don't include the mask argument,
37-
// dateFormat.masks.default is used
38-
now.format();
39-
// Sat Jun 09 2007 17:46:21
40-
41-
// And if you don't include the date argument,
42-
// the current date and time is used
43-
dateFormat();
44-
// Sat Jun 09 2007 17:46:22
45-
46-
// You can also skip the date argument (as long as your mask doesn't
47-
// contain any numbers), in which case the current date/time is used
48-
dateFormat("longTime");
49-
// 5:46:22 PM EST
50-
51-
// And finally, you can convert local time to UTC time. Either pass in
52-
// true as an additional argument (no argument skipping allowed in this case):
53-
dateFormat(now, "longTime", true);
54-
now.format("longTime", true);
55-
// Both lines return, e.g., 10:46:21 PM UTC
15+
<table cellspacing="0" summary="Date Format named masks">
16+
<thead>
17+
<tr>
18+
<th>Name</th>
19+
<th>Mask</th>
20+
<th>Example</th>
21+
</tr>
22+
</thead>
23+
<tbody>
24+
<tr>
25+
<td>default</td>
26+
<td>ddd mmm dd yyyy HH:MM:ss</td>
27+
<td>Sat Jun 09 2010 17:46:21</td>
28+
</tr>
29+
<tr class="altBg">
30+
<td>shortDate</td>
31+
<td>m/d/yy</td>
32+
<td>6/9/07</td>
33+
</tr>
34+
<tr>
35+
<td>mediumDate</td>
36+
<td>mmm d, yyyy</td>
37+
<td>Jun 9, 2010</td>
38+
</tr>
39+
<tr class="altBg">
40+
<td>longDate</td>
41+
<td>mmmm d, yyyy</td>
42+
<td>June 9, 2010</td>
43+
</tr>
44+
<tr>
45+
<td>fullDate</td>
46+
<td>dddd, mmmm d, yyyy</td>
47+
<td>Saturday, June 9, 2010</td>
48+
</tr>
49+
<tr class="altBg">
50+
<td>shortTime</td>
51+
<td>h:MM TT</td>
52+
<td>5:46 PM</td>
53+
</tr>
54+
<tr>
55+
<td>mediumTime</td>
56+
<td>h:MM:ss TT</td>
57+
<td>5:46:21 PM</td>
58+
</tr>
59+
<tr class="altBg">
60+
<td>longTime</td>
61+
<td>h:MM:ss TT Z</td>
62+
<td>5:46:21 PM EST</td>
63+
</tr>
64+
<tr>
65+
<td>isoDate</td>
66+
<td>yyyy-mm-dd</td>
67+
<td>2010-06-09</td>
68+
</tr>
69+
<tr class="altBg">
70+
<td>isoTime</td>
71+
<td>HH:MM:ss</td>
72+
<td>17:46:21</td>
73+
</tr>
74+
<tr>
75+
<td>isoDateTime</td>
76+
<td>yyyy-mm-dd'T'HH:MM:ss</td>
77+
<td>2010-06-09T17:46:21</td>
78+
</tr>
79+
<tr class="altBg">
80+
<td>isoUtcDateTime</td>
81+
<td>UTC:yyyy-mm-dd'T'HH:MM:ss'Z'</td>
82+
<td>2010-06-09T22:46:21Z</td>
83+
</tr>
84+
</tbody>
85+
</table>
5686

57-
// ...Or add the prefix "UTC:" to your mask.
58-
now.format("UTC:h:MM:ss TT Z");
59-
// 10:46:21 PM UTC
6087

88+
<h3>custom dateTime masks</h3>
6189

6290
<table cellspacing="0" summary="Date Format mask metasequences">
6391
<thead>
@@ -192,76 +220,3 @@ now.format("UTC:h:MM:ss TT Z");
192220
</tr>
193221
</tbody>
194222
</table>
195-
196-
197-
<table cellspacing="0" summary="Date Format named masks">
198-
<thead>
199-
<tr>
200-
<th>Name</th>
201-
<th>Mask</th>
202-
<th>Example</th>
203-
</tr>
204-
</thead>
205-
<tbody>
206-
<tr>
207-
<td>default</td>
208-
<td>ddd mmm dd yyyy HH:MM:ss</td>
209-
<td>Sat Jun 09 2007 17:46:21</td>
210-
</tr>
211-
<tr class="altBg">
212-
<td>shortDate</td>
213-
<td>m/d/yy</td>
214-
<td>6/9/07</td>
215-
</tr>
216-
<tr>
217-
<td>mediumDate</td>
218-
<td>mmm d, yyyy</td>
219-
<td>Jun 9, 2007</td>
220-
</tr>
221-
<tr class="altBg">
222-
<td>longDate</td>
223-
<td>mmmm d, yyyy</td>
224-
<td>June 9, 2007</td>
225-
</tr>
226-
<tr>
227-
<td>fullDate</td>
228-
<td>dddd, mmmm d, yyyy</td>
229-
<td>Saturday, June 9, 2007</td>
230-
</tr>
231-
<tr class="altBg">
232-
<td>shortTime</td>
233-
<td>h:MM TT</td>
234-
<td>5:46 PM</td>
235-
</tr>
236-
<tr>
237-
<td>mediumTime</td>
238-
<td>h:MM:ss TT</td>
239-
<td>5:46:21 PM</td>
240-
</tr>
241-
<tr class="altBg">
242-
<td>longTime</td>
243-
<td>h:MM:ss TT Z</td>
244-
<td>5:46:21 PM EST</td>
245-
</tr>
246-
<tr>
247-
<td>isoDate</td>
248-
<td>yyyy-mm-dd</td>
249-
<td>2007-06-09</td>
250-
</tr>
251-
<tr class="altBg">
252-
<td>isoTime</td>
253-
<td>HH:MM:ss</td>
254-
<td>17:46:21</td>
255-
</tr>
256-
<tr>
257-
<td>isoDateTime</td>
258-
<td>yyyy-mm-dd'T'HH:MM:ss</td>
259-
<td>2007-06-09T17:46:21</td>
260-
</tr>
261-
<tr class="altBg">
262-
<td>isoUtcDateTime</td>
263-
<td>UTC:yyyy-mm-dd'T'HH:MM:ss'Z'</td>
264-
<td>2007-06-09T22:46:21Z</td>
265-
</tr>
266-
</tbody>
267-
</table>

BUILD/docs.js

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,67 @@
55
<td>
66
<h1>javascript-fu</h1>
77
<h2>isFu</h2>
8-
<h4><em>the art of the curious type checker</em></h3>
8+
<h4><em>the art of the curious type checker</em></h4>
99
<h2>toFu</h2>
10-
<h4><em>the deadly art of the monkey punch</em></h3>
11-
<h2>dateTimeFu</h2>
12-
<h4><em>the art of time and space</em></h3>
10+
<h4><em>the deadly art of the monkey punch</em></h4>
1311
<h2>getFu</h2>
14-
<h4><em>the art of the swift getter</em></h3>
15-
<br/>
12+
<h4><em>the art of the swift getter</em></h4>
13+
<h2>dateTimeFu</h2>
14+
<h4><em>the art of time and space</em></h4>
15+
<h2>linqFu</h2>
16+
<h4><em>the forbidden art of querying JSON</em></h4>
1617
<br/>
1718
</td>
1819
</tr>
1920
</table>
2021

21-
<h2>the three disciplines of javascript-fu</h2>
22-
23-
<h3>isFu - the art of the curious type checker</h3>
24-
22+
<h1>the five disciplines of javascript-fu</h1>
23+
<h2>isFu - the art of the curious type checker</h2>
2524
isFu methods will accept <em>anything</em> as an argument and gracefully return true or false depending on if the arguments match the type you have checked for
26-
2725
{{{isFu}}}
2826

29-
<h3>toFu - the deadly art of the monkey punch</h3>
30-
27+
<h2>toFu - the deadly art of the monkey punch</h2>
3128
toFu methods will accept <em>anything</em> as an argument and aggressively attempt to coerce the value into the type you have specified
32-
3329
{{{toFu}}}
3430

31+
<h2>getFu - the art of the swift getter</h2>
32+
{{{getFu}}}
3533

36-
<h3>dateTimeFu - the art of space and time</h3>
3734

35+
<h2>dateTimeFu - the art of space and time</h2>
3836
{{{dateTimeFu}}}
3937

40-
<h3>getFu - the art of the swift getter</h3>
41-
{{{getFu}}}
38+
<h2>linqFu - the forbidden art of querying JSON with LINQ, liberated from...<em>Microsoft</em></h2>
39+
<a href = "http://maraksquires.com/JSLINQ/">Try out the interactive demo of JSLINQ</a> <br/>
40+
41+
linqFu is adds the <a href = "http://github.com/marak/jslinq">JSLINQ project</a> which is a pure javascript implementation of <em>gasp</em> Microsoft's <a href = "http://en.wikipedia.org/wiki/Language_Integrated_Query">LINQ</a> query language. it's very usefull for quickly querying JSON objects.
42+
43+
###simple Select
44+
45+
var sample = fu.linq(sampleData).
46+
Select(function (item) {return item.FirstName;});
47+
48+
output: {"items":["Chris","Kate","Josh","John","Steve","Katie","Dirk","Chris","Bernard","Kate"]}
49+
50+
###simple Select with OrderBy
51+
52+
var sample = fu.linq(sampleData).
53+
Select(function (item) {return item.FirstName;}).
54+
OrderBy(function (item) {return item;});
55+
56+
output: {"items":["Bernard","Chris","Chris","Dirk","John","Josh","Kate","Kate","Katie","Steve"]}
57+
58+
###simple Where
59+
var sample = fu.linq(sampleData).Where(function (item) {return item.FirstName == "Chris";});
60+
61+
output: [
62+
{"ID":1,"FirstName":"Chris","LastName":"Pearson","BookIDs":[1001,1002,1003]},
63+
{"ID":8,"FirstName":"Chris","LastName":"Stevenson","BookIDs":[4001,4002,4003]}
64+
]
65+
66+
###For the Full JSLINQ Demo and API implementation goto @ [http://maraksquires.com/JSLINQ/](http://maraksquires.com/JSLINQ/)
67+
68+
{{{linqFu}}}
4269

4370
<h2>Authors</h2>
4471

0 commit comments

Comments
 (0)