How to use has - 9 common examples

To help you get started, we’ve selected a few has examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
createMountRenderer(options) {
    assertDomAvailable('mount');
    if (has(options, 'suspenseFallback')) {
      throw new TypeError('`suspenseFallback` is not supported by the `mount` renderer');
    }
    if (FiberTags === null) {
      // Requires DOM.
      FiberTags = detectFiberTags();
    }
    const { attachTo, hydrateIn, wrappingComponentProps } = options;
    const domNode = hydrateIn || attachTo || global.document.createElement('div');
    let instance = null;
    const adapter = this;
    return {
      render(el, context, callback) {
        return wrapAct(() => {
          if (instance === null) {
            const { type, props, ref } = el;
            const wrapperProps = {
github Tencent / bk-cmdb / src / ui / src / views / business-topology / children / service-node-info.vue View on Github external
async getProperties() {
        let properties = []
        const { modelId } = this
        if (has(this.propertyMap, modelId)) {
          properties = this.propertyMap[modelId]
        } else {
          const action = 'objectModelProperty/searchObjectAttribute'
          properties = await this.$store.dispatch(action, {
            params: {
              bk_biz_id: this.business,
              bk_obj_id: modelId,
              bk_supplier_account: this.$store.getters.supplierAccount
            },
            config: {
              requestId: 'getModelProperties'
            }
          })
          this.$store.commit('businessHost/setProperties', {
            id: modelId,
            properties
github Automattic / jetpack / modules / search / instant-search / components / search-result-minimal.jsx View on Github external
if ( result_type !== 'post' ) {
			return null;
		}
		const noMatchingContent = ! highlight.content || highlight.content[ 0 ] === '';
		return (
			<div>
				<span>
					{ new Date( fields.date.split( ' ' )[ 0 ] ).toLocaleDateString( locale, {
						dateStyle: 'short',
					} ) }
				</span>
				<h3>
					
					<a href="{">
				</a></h3><a href="{">
				{ noMatchingContent ? this.renderNoMatchingContent() : this.renderMatchingContent() }
				
			</a></div><a href="{">
		);
	}
}</a>
github airbnb / enzyme / packages / enzyme / src / Debug.js View on Github external
function isRSTNodeLike(node) {
  return has(node, 'nodeType')
    && typeof node.nodeType === 'string'
    && has(node, 'type')
    && has(node, 'key')
    && has(node, 'ref')
    && has(node, 'instance')
    && has(node, 'rendered');
}
github airbnb / enzyme / packages / enzyme / src / Utils.js View on Github external
export function spyMethod(instance, methodName, getStub = () => {}) {
  let lastReturnValue;
  const originalMethod = instance[methodName];
  const hasOwn = has(instance, methodName);
  let descriptor;
  if (hasOwn) {
    descriptor = Object.getOwnPropertyDescriptor(instance, methodName);
  }
  Object.defineProperty(instance, methodName, {
    configurable: true,
    enumerable: !descriptor || !!descriptor.enumerable,
    value: getStub(originalMethod) || function spied(...args) {
      const result = originalMethod.apply(this, args);
      lastReturnValue = result;
      return result;
    },
  });
  return {
    restore() {
      if (hasOwn) {
github Tencent / bk-cmdb / src / ui / src / views / index / index.vue View on Github external
      const showFullText = ['keywords', 'show'].every(key => has(query, key))
      if (showFullText && this.isFullTextSearch) {
github taozhi8833998 / node-sql-parser / src / util.js View on Github external
function createBinaryExpr(operator, left, right) {
  const expr = { operator, type: 'binary_expr' }
  expr.left = has(left, 'type') ? left : createValueExpr(left)
  if (operator === 'BETWEEN' || operator === 'NOT BETWEEN') {
    expr.right = {
      type  : 'expr_list',
      value : [createValueExpr(right[0]), createValueExpr(right[1])],
    }
    return expr
  }
  expr.right = has(right, 'type') ? right : createValueExpr(right)
  return expr
}
github airbnb / enzyme / packages / enzyme / src / Debug.js View on Github external
function isRSTNodeLike(node) {
  return has(node, 'nodeType')
    && typeof node.nodeType === 'string'
    && has(node, 'type')
    && has(node, 'key')
    && has(node, 'ref')
    && has(node, 'instance')
    && has(node, 'rendered');
}

has

Object.prototype.hasOwnProperty.call shortcut

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis

Popular has functions