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


TypeScript lodash.tail函數代碼示例

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


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

示例1: cat

function cat(...rest: any[]) {
  const head = _.head(rest)
  if (existy(head)) {
    return Array.prototype.concat.apply(head, _.tail(rest)) // remove apply eg: head.concat.apply(head, _.tail(rest))
  }
  return []
}
開發者ID:galenjiang,項目名稱:hexo,代碼行數:7,代碼來源:base.ts

示例2: csv2json

export function csv2json(csv:string): Object[] {
  const headers = csv.split('\n')[0].split(',').map(header => {return _.trim(header, '"')});
  const lines = _.tail(csv.split('\n'));
  return lines.map(line => {
    let values = _.map(line.split(','), value => {return _.trim(value, '"')});
    values = values.map(value => {return value.length === 0 ? null : value;});
    return _.zipObject(headers, values);
  });
}
開發者ID:JumpeiArashi,項目名稱:spreadsheet-sql,代碼行數:9,代碼來源:Utils.ts

示例3: _compileTemplate

 _compileTemplate(template, extension) {
   const lines = template.split('\n');
   if (extension == '.html') {
     lines.unshift('');
   }
   return {
     subject: lines[0],
     body: _.tail(lines).join('\n')
   };
 }
開發者ID:bitpay,項目名稱:bitcore,代碼行數:10,代碼來源:pushnotificationsservice.ts

示例4: constructor

  constructor(tsv: Array<Array<string>>, public datasetId: string, public filename: string) {
    // normalize header-row in tsv-file so that if headers are missing a column
    // or identifier is indicated by an empty string

    const normalizedHeaders = this.getNormalizeHeaders(tsv);
    this.headers = new TSVHeaders(normalizedHeaders);
    this.body = new TSVBody(_.tail(tsv));
    datasetId;
    filename;
  }
開發者ID:chipster,項目名稱:chipster-web,代碼行數:10,代碼來源:TSVFile.ts

示例5: insertSeps

 function insertSeps(es : t[]) : t {
     if      (es.length === 0) { return mt() }
     else if (es.length === 1) { return es[0] }
     else if (es.length === 2) {
         const [h, e] = es
         return ([] as t[]).concat(h, lastSep, e)
     }
     else {
         const [h, t] = [_.head(es) as t, _.tail(es)]
         return ([] as t[]).concat(h, sep, insertSeps(t))
     }
 }
開發者ID:Ptival,項目名稱:PeaCoq,代碼行數:12,代碼來源:pp.ts

示例6: f

export function shrinkOne<A>(
  f: (a: A) => List<A>,
  arr: Array<A>
): List<Array<A>> {
  if (arr.length === 0) {
    return List.empty<Array<A>>();
  }
  const x0 = _.head(arr);
  const xs0 = _.tail(arr);
  const fst = f(x0).map(x1 => [x1].concat(xs0));
  const snd = shrinkOne(f, xs0).map(xs1 => [x0].concat(xs1));
  return fst.concat(snd);
}
開發者ID:srijs,項目名稱:node-arbitrator,代碼行數:13,代碼來源:shrink.ts

示例7: expect

 test.skip("Käännökset lisätty kaikilla kielillä", () => {
     const fails = [];
     for (const key of _.keys(locales[0][1])) {
         for (const locale of _.tail(locales)) {
             if (!_.isString(locale[1][key]) || _.isEmpty(locale[1][key])) {
                 fails.push({
                     kieli: locale[0],
                     avain: key,
                 });
             }
         }
     }
     expect(fails.length).toEqual(0);
 });
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:14,代碼來源:index.test.ts

示例8: extractProdBinders

export function extractProdBinders(a : ConstrExprR) : [LocalBinderExpr[], ConstrExprR] {
    if (a instanceof CProdN) {
        const [bl, c] : [any[], any] = [a.binderList, a.returnExpr]
        if (bl.length === 0) {
            return extractProdBinders(a.returnExpr)
        } else {
            const [nal, bk, t] = bl[0]
            const [blrec, cRest] = extractProdBinders(new CProdN(_.tail(bl), c))
            const l : LocalBinderExpr[] = [new CLocalAssum(nal, bk, t)]
            return [l.concat(blrec), cRest]
        }
    }
    return [[], a]
}
開發者ID:Ptival,項目名稱:PeaCoq,代碼行數:14,代碼來源:constr-expr.ts

示例9: gridRowsFromFile

export function gridRowsFromFile(fileName: string): PrimordialMap {
  const rawContents = readFileSync(fileName, 'utf8');
  const lines = rawContents.trim().split(GENERAL_LINE_SEPARATOR_REGEXP);
  const firstLine = _.head(lines);
  const gridRows = _.tail(lines);

  const startingPosSplit = firstLine.split(' ');
  const row = parseInt(startingPosSplit[ 0 ], 10) - 1;
  const col = parseInt(startingPosSplit[ 1 ], 10) - 1;

  return {
    gridRows,
    startingPosition: { row, col }
  };
}
開發者ID:zthomae,項目名稱:xanadu,代碼行數:15,代碼來源:parseGrid.ts


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