Download:
child 35:93cb406443f7
parent 33:45e83d519b20
34:a7e8ed799092
Anton Shestakov <av6@dwimlabs.net>, Tue, 22 Mar 2016 15:05:34 +0800
rivets: more idiomatic first-letter formatter

3 файлов изменено, 4 вставок(+), 7 удалений(-) [+]
coffee/rivets.coffee file | annotate | diff | comparison | revisions
js/rivets.js file | annotate | diff | comparison | revisions
js/rivets.js.map file | annotate | diff | comparison | revisions
--- a/coffee/rivets.coffee Tue Mar 22 13:33:56 2016 +0800
+++ b/coffee/rivets.coffee Tue Mar 22 15:05:34 2016 +0800
@@ -13,7 +13,7 @@
rivets.formatters['first-letter'] = (value) ->
- if value? then value.charAt(0) else ' '
+ value?.charAt?(0) ? ' '
rivets.formatters['only'] = (value, allowed...) ->
--- a/js/rivets.js Tue Mar 22 13:33:56 2016 +0800
+++ b/js/rivets.js Tue Mar 22 15:05:34 2016 +0800
@@ -19,11 +19,8 @@
};
rivets.formatters['first-letter'] = function(value) {
- if (value != null) {
- return value.charAt(0);
- } else {
- return ' ';
- }
+ var ref;
+ return (ref = value != null ? typeof value.charAt === "function" ? value.charAt(0) : void 0 : void 0) != null ? ref : ' ';
};
rivets.formatters['only'] = function() {
--- a/js/rivets.js.map Tue Mar 22 13:33:56 2016 +0800
+++ b/js/rivets.js.map Tue Mar 22 15:05:34 2016 +0800
@@ -6,5 +6,5 @@
"coffee/rivets.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;EAAA,MAAM,CAAC,QAAS,CAAA,GAAA,CAAhB,GACE;IAAA,OAAA,EAAS,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACP,GAAG,CAAC,EAAJ,CAAO,SAAA,GAAY,OAAnB,EAA4B,QAA5B;IADO,CAAT;IAGA,SAAA,EAAW,SAAC,GAAD,EAAM,OAAN,EAAe,QAAf;aACT,GAAG,CAAC,GAAJ,CAAQ,SAAA,GAAY,OAApB,EAA6B,QAA7B;IADS,CAHX;IAMA,GAAA,EAAK,SAAC,GAAD,EAAM,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