Skip to content

Instantly share code, notes, and snippets.

@Phrogz
Last active November 13, 2018 14:30
Show Gist options
  • Select an option

  • Save Phrogz/1a74e3fcfe0a37432a46aed96a7f45b3 to your computer and use it in GitHub Desktop.

Select an option

Save Phrogz/1a74e3fcfe0a37432a46aed96a7f45b3 to your computer and use it in GitHub Desktop.

Revisions

  1. Phrogz revised this gist Nov 13, 2018. No changes.
  2. Phrogz revised this gist Nov 13, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ƒ.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    function ƒ(name){
    let v,params=Array.prototype.slice.call(arguments,1);
    return o=>(typeof (v=o[name])==='function' ? v.apply(o,params) : v )
    return o=>(typeof (v=o[name])==='function' ? v.apply(o,params) : v);
    }

    a = ["foo", "barmitzvah"]
  3. Phrogz created this gist Nov 12, 2018.
    9 changes: 9 additions & 0 deletions ƒ.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    function ƒ(name){
    let v,params=Array.prototype.slice.call(arguments,1);
    return o=>(typeof (v=o[name])==='function' ? v.apply(o,params) : v )
    }

    a = ["foo", "barmitzvah"]
    a.map(ƒ('length')) // [3, 10]
    a.map(ƒ('toUpperCase')) // ["FOO", "BARMITZVAH"]
    a.map(ƒ('slice',1)) // ["oo", "armitzvah"]