JSPM

@silen/is-function

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q51838F
  • License MIT

Check if the parameter is function

Package Exports

  • @silen/is-function

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@silen/is-function) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-function

Determine if a value is Function

install

npm i @silen/is-function

api

  • declare function isFunction(val: any): boolean;

usage

const { isFunction } = require('@silen/is-function');
// or
import { isFunction } from '@silen/is-function';

console.log(isFunction(new Buffer(4)));
console.log(isFunction(Buffer.alloc(4)));
console.log(isFunction(undefined));
console.log(isFunction(null));
console.log(isFunction(''));
console.log(isFunction(true));
console.log(isFunction(0));
console.log(isFunction(1));
console.log(isFunction(1.0));
console.log(isFunction('string'));
console.log(isFunction({}));
console.log(isFunction(function foo() {}));
console.log(isFunction(Symbol()));
console.log(isFunction(new Set));
console.log(isFunction(new Map));
console.log(isFunction(new WeakMap));
console.log(isFunction(new WeakSet));

// or
console.log(window.Type.isFunction(new WeakSet));

This is a demo for testing the usage of isFunction from @silen/is-function module. You can try the others and do likewise.

others