當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.contains函數代碼示例

本文整理匯總了TypeScript中lodash.contains函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript contains函數的具體用法?TypeScript contains怎麽用?TypeScript contains使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了contains函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 }).then((body) => {
   return {
     memberId: body ? body.id : null,
     memberEmail: body ? body.email : null,
     hasPermissions: _.contains(body ? body.organizationsWithSite : null, site),
     isSymphonyEmployee: _.contains(body ? body.email : null, `symphonycommerce`)
   }
 });
開發者ID:rey-symphony,項目名稱:node-symphony,代碼行數:8,代碼來源:Member.ts

示例2: parseDateMath

export function parseDateMath(mathString, time, roundUp?) {
  var dateTime = time;
  var i = 0;
  var len = mathString.length;

  while (i < len) {
    var c = mathString.charAt(i++);
    var type;
    var num;
    var unit;

    if (c === '/') {
      type = 0;
    } else if (c === '+') {
      type = 1;
    } else if (c === '-') {
      type = 2;
    } else {
      return undefined;
    }

    if (isNaN(mathString.charAt(i))) {
      num = 1;
    } else if (mathString.length === 2) {
      num = mathString.charAt(i);
    } else {
      var numFrom = i;
      while (!isNaN(mathString.charAt(i))) {
        i++;
        if (i > 10) { return undefined; }
      }
      num = parseInt(mathString.substring(numFrom, i), 10);
    }

    if (type === 0) {
      // rounding is only allowed on whole, single, units (eg M or 1M, not 0.5M or 2M)
      if (num !== 1) {
        return undefined;
      }
    }
    unit = mathString.charAt(i++);

    if (!_.contains(units, unit)) {
      return undefined;
    } else {
      if (type === 0) {
        if (roundUp) {
          dateTime.endOf(unit);
        } else {
          dateTime.startOf(unit);
        }
      } else if (type === 1) {
        dateTime.add(num, unit);
      } else if (type === 2) {
        dateTime.subtract(num, unit);
      }
    }
  }
  return dateTime;
}
開發者ID:0x01feng,項目名稱:grafana,代碼行數:60,代碼來源:datemath.ts

示例3: enroll

	public enroll(attendee: TAttendee): Promise<boolean> {
		if (!_.contains(this._attendees, attendee)) {
			this._attendees.push(attendee);
		}
		
		return Promise.resolve(true);
	}
開發者ID:adamcarr,項目名稱:forge-di-smithy,代碼行數:7,代碼來源:Lecture.ts

示例4: fetch

 var getReleases = (res: BowerResult) => {
     if (!_.contains(res.url, 'github')) {
         return;
     }
     var url = res.url.replace('.git', '/tags').replace('git://github.com/', 'https://api.github.com/repos/');
     return fetch(url);
 };
開發者ID:BloodyEnterprise,項目名稱:atom-json-schema,代碼行數:7,代碼來源:bower-provider.ts

示例5: onkoOikeudet

 function onkoOikeudet(target, permission) {
     if (oikeudet) {
         if (_.contains(oikeudet[target], permission)) {
             return true;
         }
     }
     return false;
 }
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:8,代碼來源:perusteprojekti.ts

示例6:

 .each(function(osa) {
     const match =
         $scope.tutkinnonOsat.rajaus &&
         _.contains(Kaanna.kaanna(osa.nimi).toLowerCase(), $scope.tutkinnonOsat.rajaus.toLowerCase());
     if (!$scope.tutkinnonOsat.rajaus || match) {
         uudetUniikit.push({ _tutkinnonOsaViite: osa.id });
     }
 })
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:8,代碼來源:tree.ts

示例7: canRedirectRequest

export function canRedirectRequest(request: Request) {
  const hasVersionHeader = has(request.raw.req.headers, KIBANA_VERSION_HEADER);
  const hasXsrfHeader = has(request.raw.req.headers, KIBANA_XSRF_HEADER);

  const isApiRoute = contains(get(request, 'route.settings.tags'), ROUTE_TAG_API);
  const isAjaxRequest = hasVersionHeader || hasXsrfHeader;

  return !isApiRoute && !isAjaxRequest;
}
開發者ID:elastic,項目名稱:kibana,代碼行數:9,代碼來源:can_redirect_request.ts

示例8: reportSignal

function reportSignal(signal) {
  if (_.contains(acceptSignals, signal.name)) {
    var signals = db.collection('signals');
    Q.npost(signals, "insert", [signal])
      .fail(function(err) {
        console.log("insert error: ", err);
      });
  }
}
開發者ID:filipstachura,項目名稱:sensas-platform,代碼行數:9,代碼來源:index.ts

示例9: if

 tokens.forEach((token) => {
   const kv = token.split('=');
   // Special backwards compatibility for URI components like #events
   if (kv.length === 1 && _.contains(TABS, kv[0])) {
     items[TAB] = kv[0];
   } else if (kv.length === 2) {
     items[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);
   }
 });
開發者ID:AlbertXiebnu,項目名稱:tensorflow,代碼行數:9,代碼來源:storage.ts

示例10:

            _.map(this.exports, exp => {
                // special cases
                if (_.contains(exp.name, 'jQuery') || _.contains(exp.name, '$'))
                    return '';

                var name = exp.name;
                if (name === this.displayName) {
                    name = '_' + this.displayName;
                }

                var item = _.repeat(' ', indent + 4);
                if (exp.project) {
                    return `${item}var ${exp.name} : typeof ${exp.projectName}.${exp.name};`;
                } else {
                    var cls = _.find(classes, x => x.name === exp.name);

                    if (cls && ProjectConverted.getProjectDisplayName(cls.project) !== exp.name && !_.any(this.references, imp => imp.projectName === cls.name)) {
                        return `${item}class ${exp.name} extends ${ProjectConverted.getProjectDisplayName(cls.project) }.${exp.name} {}`;
                    } else {
                        //return `${item}export var ${exp.name} : typeof ${this.displayName}.${exp.name};`;
                    }
                }
            })
開發者ID:david-driscoll,項目名稱:atom-typescript-generator,代碼行數:23,代碼來源:Project.ts


注:本文中的lodash.contains函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。