@jswork/is-arrow-fn
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

is-arrow-fn

Determine if a function is an ES6 arrow function or not.

version license size download

installation

npm install @jswork/is-arrow-fn

usage

import isArrowFn from '@jswork/is-arrow-fn';

const obj = {
  fn1() {
    console.log("normal fn1", this);
  },
  fn2: () => {
    console.log("arrow fn2", this);
  },
  fn3: function () {
    console.log("normal fn3", this);
  },
  fn4: function () {
    return () => {
      console.log("123");
    };
  },
};

isArrowFn(obj.fn1); // false
isArrowFn(obj.fn2); // true
isArrowFn(obj.fn3); // false
isArrowFn(obj.fn4); // false

license

Code released under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i @jswork/is-arrow-fn

Homepage

js.work

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.75 kB

Total Files

6

Last publish

Collaborators

  • afeiship