• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ramda.reject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ramda.reject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript reject函数的具体用法?TypeScript reject怎么用?TypeScript reject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了reject函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: formatRemotes

export function formatRemotes(remotes: string[]) : string[] {
  const process = R.compose(
    R.uniq,
    R.map(R.replace(/\/$/, '')),
    R.reject(R.isEmpty),
    R.map(R.replace(/\n/, '')),
    R.map(R.trim),
    R.map(rem => rem.replace(/\/\/(.+)@github/, '//github')),
    R.map(rem =>
      rem.match(/github\.com/)
        ? rem.replace(/\.git(\b|$)/, '')
        : rem),
    R.reject(R.isNil),
    R.map(rem => {
      if (rem.match(/^https?:/)) {
        return rem.replace(/\.git(\b|$)/, '');
      } else if (rem.match(/@/)) {
        return 'https://' +
          rem
            .replace(/^.+@/, '')
            .replace(/\.git(\b|$)/, '')
            .replace(/:/g, '/');
      } else if (rem.match(/^ftps?:/)) {
        return rem.replace(/^ftp/, 'http');
      } else if (rem.match(/^ssh:/)) {
        return rem.replace(/^ssh/, 'https');
      } else if (rem.match(/^git:/)) {
        return rem.replace(/^git/, 'https');
      }
    })
  );

  return process(remotes);
}
开发者ID:d4rkr00t,项目名称:vscode-open-in-github,代码行数:34,代码来源:common.ts


示例2: switch

export const companyReducer: ActionReducer<any> = (state: CompanyState = INITIAL_STATE, action: Action) => {
	switch (action.type) {
		case CompanyAction.CHILD_ADDED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: [...state.entities, process(action.payload)]
			});

		case CompanyAction.CHILD_CHANGED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: [...R.reject(R.propEq('$key', action.payload.$key))(state.entities),
				process(action.payload)]
			});

		case CompanyAction.CHILD_REMOVED:
			state.entities = state.entities || [];
			return Object.assign({ }, state, {
				entities: R.reject(R.propEq('$key', action.payload.$key))(state.entities)
			});

		case CompanyAction.LOAD:
			return Object.assign({ }, state, {
				entities: undefined,
			});

		case CompanyAction.SELECT:
			return Object.assign({ }, state, {
				selected: action.payload
			});

		default:
		  return state;
	}
}
开发者ID:simbiosis-group,项目名称:ion2-contact,代码行数:35,代码来源:company.reducer.ts


示例3: clean

 /**
  * Return a clean part of the model for updating to database
  */
 static clean(model) {
   const removeComputedProps = R.pipe(
     R.mapObjIndexed((x , key) => {
       if (key.indexOf('$') >= 0) { return undefined }
       return x;
     }),
     R.reject(R.isNil)
   );
   const trimValues = R.map(n => { return R.is(String, n) ? R.trim(n) : n });
   const removeNullFields = R.reject(R.isNil)
   return R.pipe(removeComputedProps, trimValues, removeNullFields)(model);
 }
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:15,代码来源:record-helper.ts


示例4: sendSubscriptions

    /**
     * Sends all subscribed values to the Reactotron app.
     *
     * @param node The tree to grab the state data from
     */
    function sendSubscriptions(state: any) {
      // this is unreadable
      const changes = pipe(
        map(when(isNil, always(""))) as any,
        filter(endsWith(".*")),
        map((key: string) => {
          const keyMinusWildcard = slice(0, -2, key)
          const value = dotPath(keyMinusWildcard, state)
          if (is(Object, value) && !isNilOrEmpty(value)) {
            return pipe(keys, map(key => `${keyMinusWildcard}.${key}`))(value)
          }
          return []
        }) as any,
        concat(map(when(isNil, always("")), subscriptions)),
        flatten,
        reject(endsWith(".*")) as any,
        uniq as any,
        sortBy(identity) as any,
        map((key: string) => ({
          path: key,
          value: isNilOrEmpty(key) ? state : dotPath(key, state),
        })),
      )(subscriptions)

      reactotron.stateValuesChange(changes)
    }
开发者ID:nick121212,项目名称:reactotron,代码行数:31,代码来源:reactotron-mst.ts


示例5:

export const clean = (obj) => {
	const nilEmpty: any = R.mapObjIndexed((x , key) => (R.isEmpty(x)) ? undefined : x);
	const nilComputed: any = R.mapObjIndexed((x , key) => (key.indexOf('$') >= 0) ? undefined : x);
	const trimProps = R.map((n: any) => R.is(String, n) ? R.trim(n) : n);
	const cleanNil = R.reject(R.isNil);
	return R.pipe(nilEmpty, nilComputed, trimProps, cleanNil)(obj);
}
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:7,代码来源:index.ts


示例6:

export const sendEmail$ = (applicant) => {
	const cc = '[email protected]';
	const array = R.reject(R.isNil)([
		applicant.hasSps ? 'SPS' : null,
		applicant.hasSrp ? 'SRP' : null,
		applicant.hasSrpSupervisor ? 'SRP Approved Supervisor' : null,
	]);
	const applicantText = R.reduce((a, n) => (a === '') ? n : `${a}, ${n}`, '')(array);
	const text = `<p>Dear ${applicant.applicantName}</p><p>We have received your ${applicantText} applicant package.</p><p>We will keep you updated on the progress.</p><p>Thank you</p>`;

	return this.mailgun.send$(`${applicant.applicantEmail}`, 'Applicant Received', text, cc)
		.first()
		.catch(err => {
			console.log(err);
			return Observable.of(err)
		})
}
开发者ID:simbiosis-group,项目名称:ion2-member,代码行数:17,代码来源:applicant.model.ts


示例7: getAllRemotes

export function getAllRemotes(exec, projectPath: string) : Promise<string[]> {
  const process = R.compose(
    R.uniq,
    R.map(R.head),
    R.map(R.split(' ')),
    R.reject(R.isEmpty),
    R.map(R.last),
    R.map(R.split(/\t/)),
    R.split('\n')
  );

  return new Promise((resolve, reject) => {
    exec('git remote -v', { cwd: projectPath }, (error, stdout, stderr) => {
      if (stderr || error) return reject(stderr || error);
      resolve(process(stdout));
    });
  });
}
开发者ID:d4rkr00t,项目名称:vscode-open-in-github,代码行数:18,代码来源:common.ts


示例8: getFirstBookmarkTree

export function* getFirstBookmarkTree(options: Partial<Options>): SagaIterator {
  const [firstTreeInfo, rootFolders]: [BookmarkTree, Array<BookmarkInfo>] = yield all([
    call(getBookmarkTree, String(options[CST.OPTIONS.DEF_EXPAND])),
    call(getBookmarkChildren, CST.ROOT_ID)
  ])
  return {
    ...firstTreeInfo,
    children: [
      ...R.reject((bookmarkInfo) => {
        const idNumber = Number(bookmarkInfo.id)
        return (
          idNumber === options[CST.OPTIONS.DEF_EXPAND] ||
          (options[CST.OPTIONS.HIDE_ROOT_FOLDER] || []).includes(idNumber)
        )
      }, rootFolders),
      ...firstTreeInfo.children
    ]
  }
}
开发者ID:foray1010,项目名称:Popup-my-Bookmarks,代码行数:19,代码来源:getters.ts


示例9: clean

  static clean(required, strings, floats, data) {
    const rejectEmpty = R.reject(n => R.isEmpty(n[required]));

    const cleanStrings = R.map(n => {
      n[strings] = R.trim(n[strings]);
      return n;
    });

    const cleanFloats = R.map(n => {
      n[floats] = parseFloat(n[floats]);
      return n;
    });

    const clean = R.pipe(rejectEmpty,
      cleanStrings,
      cleanFloats
    );

    return clean(data);
  }
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:20,代码来源:array-helper.ts


示例10:

 return R.map(updateItem(itemId, (it: ITodoItem) =>
     R.merge(it, { states: R.reject(R.eq(state), it.states) })), items);
开发者ID:ababup1192,项目名称:react-bacon-todomvc-typescript,代码行数:2,代码来源:todos.ts



注:本文中的ramda.reject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ramda.replace函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ramda.reduce函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap