New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-vue-component

Check if the given value is a valid Vue component.

0.1.0
73

Supply Chain Security

100

Vulnerability

96

Quality

75

Maintenance

100

License

Version published
Weekly downloads
675
4.33%
Maintainers
1
Weekly downloads
 
Created

is-vue-component

Build Status Downloads Version

Check if the given value is a valid Vue component.

What is a valid Vue component?

  • It is a plain object.
  • 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

FAQs

Package last updated on 15 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts