# coffeescript-helpers

> CoffeeScript helper functions

Latest version **2.2.0** (published 2015-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install coffeescript-helpers
pnpm add coffeescript-helpers
yarn add coffeescript-helpers
bun add coffeescript-helpers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2015-12-28 |
| First published | 2014-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Stéphane Alnet |
| Maintainers | shimaore |

## Links

- npm: https://www.npmjs.com/package/coffeescript-helpers
- npm.io page: https://npm.io/package/coffeescript-helpers

## Recent versions

- 2.2.0 (latest) — 2015-12-28
- 2.1.1 — 2015-11-13
- 2.1.0 — 2015-05-26
- 2.0.0 — 2015-02-20
- 1.0.4 — 2014-11-07
- 1.0.3 — 2014-11-07
- 1.0.2 — 2014-11-07

## README

CoffeeScript helpers
====================

Usage
-----

`{helpers,p_fun,p_exec} = require 'coffeescript-helpers'`

`helpers`
---------

Contains the helpers installed by CoffeeScript.

    @helpers = helpers = """
    var slice = [].slice;
    var hasProp = {}.hasOwnProperty;
    var bind = function(fn, me){
    return function(){ return fn.apply(me, arguments); };
    };
    var extend = function(child, parent) {
    for (var key in parent) {
    if (hasProp.call(parent, key)) child[key] = parent[key];
    }
    function ctor() { this.constructor = child; }
    ctor.prototype = parent.prototype;
    child.prototype = new ctor();
    child.__super__ = parent.prototype;
    return child;
    };
    var indexOf = [].indexOf || function(item) {
    for (var i = 0, l = this.length; i < l; i++) {
    if (i in this && this[i] === item) return i;
    } return -1; };
    var modulo = function(a, b) { return (+a % (b = +b) + b) % b; };
    """.replace /\n/g, ''

`p_fun`
-------

Map a (compiled) CoffeeScript function to a JavaScript function with the proper helpers installed. It is intended to be used for CouchDB `map` functions, for example.

    @p_fun = (extra,f) ->
      if not f?
        f = extra
        extra = ''
      return "(function (){#{extra} #{helpers} return #{f};})();"

`p_exec`
--------

Map a (compiled) CoffeeScript function so that it actually gets executed. It is intended to wrap functions server-side so that they execute client-side (in ZappaJS for example).

    @p_exec = (extra,f) ->
      if not f?
        f = extra
        extra = ''
      return "(function (){#{extra} #{helpers} return (#{f})();})();"

---
_Source: https://npm.io/package/coffeescript-helpers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
