New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

autonomy

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autonomy

Lightweight functional utility library complementing ES5

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
increased by10.51%
Maintainers
1
Weekly downloads
 
Created
Source

Autonomy Build Status

Autonomy is a lightweight functional helper library. It is meant to complement an ES5 style with curried helpers, math helpers, curried accessors and higher order looping constructs.

These library is partly inspired by Haskell's Prelude, but its exports are optimized for JavaScript semantics and performance. It does not try to make JavaScript into something it's not.

Usage

Attach it to the short variable of choice:

var $ = require('autonomy');

and get functional:

$.id(x) === x;
$.noop(x) === undefined;

[1,3,2].map($.constant(5)); // [5, 5, 5]

[1,2,3,4,3].filter($.elem([1,3])); // [ 1, 3, 3 ]

[1,3,5,-1].some($.notElem([1,2,3,4,5])); // true

$.gcd(10, 15); // 5

[1,2,3,4,5,6].filter($.even); // [ 2, 4, 6 ]

$.range(5); // [ 1, 2, 3, 4, 5 ]

$.zip($.range(5), [1,2], [3,2,5]); // [ [ 1, 1, 3 ], [ 2, 2, 2 ] ]
$.zipWith($.plus2, [1,1,1], $.range(5)); // [ 2, 3, 4 ]

$.iterate(3, "ha!", function (str) {
  return "ha" + str
}); // [ 'ha!', 'haha!', 'hahaha!' ]

[[1,2], [3,4]].map($.invoke('join','w')); // [ '1w2', '3w4']

Read the read the API. It could also be worth looking at the operators module, which provides some excellent functional helpers for this module.

Note this module can be gotten directly as is, or gotten via the larger utility library: interlude for which it originally was made.

Installation

$ npm install autonomy

Running tests

Install development dependencies

$ npm install

Run the tests

$ npm test

License

MIT-Licensed. See LICENSE file for details.

Keywords

FAQs

Package last updated on 04 Jul 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc