{"_id":"@alexeisavca/ftools","_rev":"3-7ec984e2a2ea7c48edc911e3416db105","name":"@alexeisavca/ftools","description":"A collection of functional functions","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@alexeisavca/ftools","version":"0.0.1","description":"A collection of functional functions","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/alexeisavca/ftools.git"},"keywords":["fp","functional"],"author":{"name":"Alexei Savca"},"license":"ISC","bugs":{"url":"https://github.com/alexeisavca/ftools/issues"},"homepage":"https://github.com/alexeisavca/ftools#readme","gitHead":"5dd20a10dcf2181a4bf457c587772e38f70d8e6c","_id":"@alexeisavca/ftools@0.0.1","_shasum":"c539b059fac37b8f574a122175bd07491a2be501","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"alexeisavca","email":"diogene.din.pizdiuseni@gmail.com"},"dist":{"shasum":"c539b059fac37b8f574a122175bd07491a2be501","tarball":"https://registry.npmjs.org/@alexeisavca/ftools/-/ftools-0.0.1.tgz","integrity":"sha512-N8SZAAkBHW/YUh/CGGd+9xmnlNsEMAryOEePjWu8IiNyVXmFruU37fLPhQ46owxmHg6h75NPdKqcSLYL3MX+/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7k12rhQQgy1CXax+oaU5ObK5/r7yNoUpxhdkbs4yHPAIgAUg2zgoBuFo4ZYMBNkGmx3sKrNMAa6DUC3n3JTWnUyM="}]},"maintainers":[{"name":"alexeisavca","email":"diogene.din.pizdiuseni@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ftools-0.0.1.tgz_1466613127301_0.20628082286566496"}}},"readme":"#Ftools\r\nThis is a collection of functions I use a lot. I got tired of copypasting them and/or reinventing the wheel over and over\r\nso I gathered them all here.\r\n\r\n##Usage\r\n    npm install @alexeisavca/ftools\r\n\r\nThis package is modular, there is no entry point, you import only the functions you need, this way it prevents dead code\r\nin your project.\r\n\r\n```js\r\nimport add from \"@alexeisavca/ftools/math/add\";\r\n[1,2,3].reduce(add);//6\r\n```\r\n\r\n##Docs\r\n### dstructs\r\nContains functions related to transformations and parsing of data structures\r\n\r\n#### obj2tuples::object => [(any, any)]\r\nConverts an object to an array of [key, value] arrays aka tuples\r\n```js\r\nobj2tuples({a: 1, b:2, c: 3})//[['a', 1], ['b', 2], ['c', 3']]\r\n```\r\n\r\n#### tuples2obj::[(any, any)] => object\r\nReverse of the above. Converts and array of (key, value) tuples to an object\r\n```js\r\ntuples2obj([['a', 1], ['b', 2], ['c', 3]])//{a: 1, b:2, c: 3}\r\n```\r\n\r\n#### withTuples::(object, [(any, any)] => [(any, any)]) => object\r\nCombination of the above. Converts an object to tuples and passes it to the callback, then converts the returned tuple\r\narray to an object\r\n```js\r\nwithTuples({a: 1, b: 2}, tuples => tuples.map(([key, value]) => [key + \"prime\", value + 1]))//{aprime: 2, bprime: 3}\r\n```\r\n\r\n#### mapObjTuples::(object, (any, any) => (any, any)) => object\r\nShorthand for the above\r\n```js\r\nmapObjTuples({a: 1, b: 2}, ([key, value]) => [key + \"prime\", value + 1])//{aprime: 2, bprime: 3}\r\n```\r\n\r\n#### mapObjValues::(object, any => any) => object\r\nMaps only the values of an object\r\n```js\r\nmapObjValues({a: 1, b: 2}, inc)//{a: 2, b: 3}\r\n```\r\n\r\n### func\r\nContains higher order functions\r\n\r\n#### pipe::(...args) => (...functions) => any\r\nFunction composition and application\r\n```js\r\npipe(1, 2, 3)(a, b, c)\r\n```\r\n\r\nis the same as\r\n```js\r\nc(b(a(1, 2, 3)))\r\n```\r\n\r\n#### compose::(...functions) => (...args) => any\r\nFunction composition and application\r\n```js\r\npipe(a, b, c)(1, 2, 3)\r\n```\r\n\r\nis the same as\r\n```js\r\na(b(c(1, 2, 3);\r\n```\r\n\r\n### math\r\nContains math related functions\r\n\r\n#### add::(any, any) => any\r\nAdds its arguments using '+', doesn't typecheck, can add numbers as well as concat strings\r\n\r\n#### inc::any => any\r\nIncrementation\r\n\r\n#### dec::any => any\r\nDecrementation\r\n\r\n### strings\r\nString related functions\r\n\r\n#### capitalize::string => string\r\nCapitalizes the first character of a string","maintainers":[{"name":"alexeisavca","email":"diogene.din.pizdiuseni@gmail.com"}],"time":{"modified":"2022-06-12T14:28:31.429Z","created":"2016-06-22T16:32:09.813Z","0.0.1":"2016-06-22T16:32:09.813Z"},"homepage":"https://github.com/alexeisavca/ftools#readme","keywords":["fp","functional"],"repository":{"type":"git","url":"git+https://github.com/alexeisavca/ftools.git"},"author":{"name":"Alexei Savca"},"bugs":{"url":"https://github.com/alexeisavca/ftools/issues"},"license":"ISC","readmeFilename":"readme.md"}