142
St
startsInvasion / files
startsInvasion / libs / node_modules / reqwest / build / valentine / README.md
1.7 KB
1 \ / _. | _ ._ _|_ o ._ _ 2 \/ (_| | (/_ | | |_ | | | (/_ 3 4JavaScript's Sister, and protector. At 1.5k Valentine provides you with type checking, functional iterators, and basic utility helpers. 5 6NPM users, install it: 7 8 $ npm install valentine 9 10Use it: 11 12``` js 13var v = require('valentine'); 14 15v.map(['a', 'b', 'c'], function (letter) { 16 return letter.toUpperCase(); 17}).join(' '); // => 'A B C' 18``` 19 20API 21--- 22 23<h3>iterators</h3> 24 25 * v.each() 26 * v.map() 27 * v.every() 28 * v.some() 29 * v.filter() 30 * v.indexOf() 31 * v.lastIndexOf() 32 * v.reduce() 33 * v.reduceRight() 34 35<h3>utility</h3> 36 37 * v.pluck() 38 * v.toArray() 39 * v.size() 40 * v.reject() 41 * v.find() 42 * v.compact() 43 * v.flatten() 44 * v.uniq() 45 * v.first() 46 * v.last() 47 * v.keys() 48 * v.trim() 49 * v.bind() 50 51<h3>type checking</h3> 52 53 * v.is.fun() 54 * v.is.str() 55 * v.is.ele() 56 * v.is.arr() 57 * v.is.num() 58 * v.is.bool() 59 * v.is.args() 60 * v.is.emp() 61 * v.is.dat() 62 * v.is.nan() 63 * v.is.nil() 64 * v.is.und() 65 * v.is.obj() 66 67Object Style 68------ 69 70``` js 71v(['a', 'b', 'c']).map(function (letter) { 72 return letter.toUpperCase(); 73}); // => ['A', 'B', 'C']; 74``` 75 76Chains 77------ 78 79``` js 80v(['a', 'b', [['c']], 0, false,,,null,['a', 'b', 'c']]) 81 .chain().flatten().compact().uniq().map(function (letter) { 82 return letter.toUpperCase(); 83 }).value(); // => ['A', 'B', 'C']; 84``` 85 86Ender Support 87------------- 88Don't have [Ender](http://ender.no.de)? Install it, and don't ever look back. 89 90 $ npm install ender -g 91 92Then build valentine into your package 93 94 $ ender build valentine 95 96Have an existing Ender package? Include it: 97 98 $ ender add valentine 99 100Write code like a boss 101 102``` js 103$.v(['a', ['virus'], 'b', 'c']).reject(function (el, i) { 104 return v.is.arr(el[i]); 105}); 106``` 107 108Happy iterating!