Function.js 505 B

12345678910111213141516171819
  1. // Used for `Function.rs` tests
  2. exports.get_function_to_bind = function() {
  3. return function() { return this.x || 1; }
  4. };
  5. exports.get_value_to_bind_to = function() {
  6. return { x: 2 };
  7. };
  8. exports.list = function() {
  9. return function() {return Array.prototype.slice.call(arguments);}
  10. };
  11. exports.add_arguments = function() {
  12. return function(arg1, arg2) {return arg1 + arg2}
  13. };
  14. exports.call_function = function(f) {
  15. return f();
  16. };
  17. exports.call_function_arg = function(f, arg1) {
  18. return f(arg1);
  19. };