This package has been deprecated

Author message:

No longer maintained.

is-vue-component

1.0.0 • Public • Published

is-vue-component

Build Status Downloads Version

Check if the given value is a valid Vue component.

What is a valid Vue component?

  1. It is a plain object.
  2. It has at least one of the following properties:
    • el: a non-empty string or an Element.
    • template: a non-empty string.
    • render: a function.
    • extends: a valid Vue component.
    • mixins: an array includes at least a valid Vue component.

Main

dist/
├── is-vue-component.js        (UMD)
├── is-vue-component.min.js    (UMD, compressed)
├── is-vue-component.common.js (CommonJS, default)
└── is-vue-component.esm.js    (ES Module)

Install

npm install is-vue-component

Usage

<div id="app"></div>
import isVueComponent from 'is-vue-component';
 
isVueComponent({
  el: '#app',
});
// > true
 
isVueComponent({
  el: document.getElementById('app'),
});
// > true
 
isVueComponent({
  template: '<p>Hello, World!</p>',
});
// > true
 
isVueComponent({
  render(createElement) {
    return createElement('p', 'Hello, World!');
  },
});
// > true
 
isVueComponent({
  extends: {
    render(createElement) {
      return createElement('p', 'Hello, World!');
    },
  },
});
// > true
 
isVueComponent({
  mixins: [
    {
      render(createElement) {
        return createElement('p', 'Hello, World!');
      },
    },
  ],
});
// > true
 
isVueComponent({});
// > false

License

MIT © Chen Fengyuan

Package Sidebar

Install

npm i is-vue-component

Weekly Downloads

983

Version

1.0.0

License

MIT

Unpacked Size

17.5 kB

Total Files

9

Last publish

Collaborators

  • chenfengyuan