coco-js

Add CoffeeScript prototype alias operator (::) to JavaScript

Usage no npm install needed!

<script type="module">
  import cocoJs from 'https://cdn.skypack.dev/coco-js';
</script>

README

coco-js

coco-js adds the CoffeeScript prototype alias operator :: to JavaScript.

npm install coco-js

Examples

Array::slice.call("string")

/*
[
  's',
  't',
  'r',
  'i',
  'n',
  'g'
]
*/


var prop = 'slice';
Array::[prop].call("string")

/*
[
  's',
  't',
  'r',
  'i',
  'n',
  'g'
]
*/

var isString = function (obj) {
  return Object::toString.call(obj) === '[object String]'
}

isString('string') // true
isString([]) // false

Tests

make test

License

MIT