{"id":2840,"date":"2013-05-16T13:25:53","date_gmt":"2013-05-16T04:25:53","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2840"},"modified":"2017-02-03T01:19:41","modified_gmt":"2017-02-02T16:19:41","slug":"post-2840","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/node-js\/2840","title":{"rendered":"[node.js]\u4fbf\u5229\u306a\u914d\u5217\u64cd\u4f5c\u30e9\u30a4\u30d6\u30e9\u30eaVodevil.js"},"content":{"rendered":"<p>\u914d\u5217\u306e\u7d50\u5408\u3084\u5207\u308a\u51fa\u3057\u306a\u3069\u304c\u7c21\u5358\u306b\u884c\u3048\u307e\u3059\u3002<br \/>\n<span class=\"removed_link\" title=\"http:\/\/vodevil.herokuapp.com\/\">Vodevil node.js module<\/span><\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<pre class=\"lang:sh decode:true \" >$ npm install vodevil\n<\/pre>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<pre class=\"lang:js decode:true \" >var vodevil = require('vodevil');\n\n\/\/vodevil.range \u914d\u5217\u3092\u751f\u6210\u3059\u308b\uff11\nvodevil.range( 5 ) \/\/=&gt; [0, 1, 2, 3, 4, 5]\nvodevil.range( 2, 5 ) \/\/=&gt; [2, 3, 4, 5]\nvodevil.range( '..5' ) \/\/=&gt; [0, 1, 2, 3, 4, 5]\nvodevil.range( '2..5' ) \/\/=&gt; [2, 3, 4, 5]\nvodevil.range( 'b..f' ) \/\/=&gt; ['b', 'c', 'd', 'e', 'f']\nvodevil.range( '..c' ) \/\/=&gt; ['a', 'b', 'c']\nvodevil.range( 'A..C' ) \/\/=&gt; ['A', 'B', 'C']\n\n\/\/vodevil.bang \u914d\u5217\u3092\u751f\u6210\u3059\u308b\uff12\nvodevil.bang( '', 2 ) \/\/=&gt; ['', '']\nvodevil.bang( 'doug', 5 ) \/\/=&gt; ['doug', 'doug', 'doug', 'doug', 'doug']\nvodevil.bang( null, 2 ) \/\/=&gt; [null, null]\nvodevil.bang( undefined, 2 ) \/\/=&gt; [undefined, undefined]\n\n\/\/vodevil.clean null\u3084undefined\u3001\u4ed6\u7279\u5b9a\u306e\u5024\u3092\u914d\u5217\u304b\u3089\u6d88\u53bb\u3059\u308b\nvodevil.clean( [undefined, 'doug', 'john'] ) \/\/=&gt; ['doug', 'john']\nvodevil.clean( [null, 'doug', 'john'] ) \/\/=&gt; ['doug', 'john']\nvodevil.clean( [ 100, 'doug', 'john'], 100 ) \/\/=&gt; ['doug', 'john']\n\n\/\/vodevil.union \u914d\u5217\u3092\u7d50\u5408\u3059\u308b\nvodevil.union( [1, 2, 3], [4, 5, 6] ) \/\/=&gt; [1, 2, 3, 4, 5, 6]\nvodevil.union( 'ab', ['c', 'd'] ) \/\/=&gt; ['a', 'b', 'c', 'd']\nvodevil.union( ['a', 'b'], 'cd' ) \/\/=&gt; ['a', 'b', 'c', 'd']\n\n\/\/vodevil.intersect \u914d\u5217\u306b\u53cd\u5fa9\u51e6\u7406\u3092\u884c\u3046\nvodevil.intersect( [1, 2, 3, 4, 5], function ( x ) { return x*2; }) \/\/=&gt; [2, 4, 6, 8, 10]\nvodevil.intersect( [1, 2, 3], function ( item, index, array ) { console.log( x ); } ) \/\/=&gt; []\nvodevil.intersect( [1, 2, 3, 4, 5], function ( x ) { return x 2; }, ':2' ) \/\/=&gt; [2, 4, 6]\nvodevil.intersect( [1, 2, 3, 4, 5, 6], function ( x ) { return x*2 }, '2::' ) \/\/=&gt; [6, 4, 2]\n\n\/\/vodevil.sail \u914d\u5217\u3092\u5207\u308a\u51fa\u3059\nvodevil.sail( [1, 2, 3, 4, 5], '2:' ) \/\/=&gt; [3, 4, 5]\nvodevil.sail( [1, 2, 3, 4, 5], '2::' ) \/\/=&gt; [3, 2, 1]\nvodevil.sail( [1, 2, 3, 4, 5, 6], '2:3' ) \/\/=&gt; [3, 4]\n\n\/\/vodevil.flush \u5165\u308c\u5b50\u306b\u306a\u3063\u305f\u5024\u3092\u5e73\u5766\u306b\u3059\u308b\nvodevil.flush( [1, [2, [3, [4, [5, [6, [7, [8, [9, [0]]]]]]]]]] ) \/\/=&gt; [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n<\/pre>\n<h2>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b5\u30a4\u30c9(\u30d6\u30e9\u30a6\u30b6)\u3067\u4f7f\u7528<\/h2>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u3082vodevil.js\u3092script\u30bf\u30b0\u3067\u8aad\u307f\u8fbc\u3081\u3070\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n(vodevil.set\u30e1\u30bd\u30c3\u30c9\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093)<\/p>\n<p>vodevil.js\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u4ee5\u4e0b(\u6700\u5f8c\u306e\u884c)\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b<\/p>\n<pre class=\"lang:js decode:true \" >\n\/\/exports.core = Vodevil;\n<\/pre>\n<p>\u5f8c\u306f\u666e\u901a\u306b\u8aad\u307f\u8fbc\u3080\u3060\u3051\u3002<\/p>\n<pre class=\"lang:xhtml decode:true \" >&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=&quot;utf-8&quot; \/&gt;\n&lt;script src=&quot;vodevil.js&quot;&gt;&lt;\/script&gt;\n&lt;script&gt;\nconsole.log( Vodevil.range( '..5' ) );\n\n&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u5217\u306e\u7d50\u5408\u3084\u5207\u308a\u51fa\u3057\u306a\u3069\u304c\u7c21\u5358\u306b\u884c\u3048\u307e\u3059\u3002 Vod&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-2840","post","type-post","status-publish","format-standard","hentry","category-javascript","category-node-js"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=2840"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2840\/revisions"}],"predecessor-version":[{"id":3258,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2840\/revisions\/3258"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}