https://github.com/bttmly/cough
coffee_script looks better in snake_case
https://github.com/bttmly/cough
Last synced: 3 months ago
JSON representation
coffee_script looks better in snake_case
- Host: GitHub
- URL: https://github.com/bttmly/cough
- Owner: bttmly
- License: mit
- Created: 2015-04-04T19:59:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-04T21:09:01.000Z (about 10 years ago)
- Last Synced: 2025-02-16T04:31:53.288Z (3 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 621 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# cough [](https://travis-ci.org/nickb1080/cough)
It's pleasant to write CoffeeScript in snake case style, but module consumers are more than likely using plain JavaScript and expecting camel cased method names.
This module requires an environment supporting [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy).
CoffeeScript
```coffeescript
cough = require "cough"
fs = cough require "fs"# this works
data = fs.read_file_sync "some-file.json"# or maybe export something snake cased, wrapped with cough
module.exports = cough
some_method_here: -> # ...
another_method_here: -> # ...
```JavaScript (importing the exported object above)
```js
var theModule = require("coffee-script-file-above");// these work
theModule.someMethodHere();
theModule.anotherMethodHere();
```Alternately, you might use it in a constructor
```coffeescript
class Something
constructor: ->
return cough @instance_method_one: ->
```Instances will respond to `instance_method_one()` or `instanceMethodOne()`.