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

TypeScript lodash.unset函数代码示例

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

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



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

示例1: sanitizeOutputFields

export function sanitizeOutputFields(document: Object): Object {
  const doc = _.clone(document);
  _.unset(doc, '_id');
  _.unset(doc, '_key');
  _.unset(doc, '_rev');
  return doc;
}
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:7,代码来源:common.ts


示例2: function

			sails.router.bind(route, function (req: any, res: any, next: Function) {

				let protocol: any = _.startsWith(swagger.host, 'http') ? '' : 'http://';
				let targetUrlTemplate: any = protocol + swagger.host + ( swagger.basePath || '' ) + path;
				let templateFn: any = _.template(targetUrlTemplate, {
					interpolate: /{([\s\S]+?)}/g
				});

				let params: any = req.allParams();

				let targetUrl: any = templateFn(params);

				let headers: any = req.headers;

				_.unset(headers, 'cookie');
				_.unset(headers, 'host');
				_.unset(headers, 'user-agent');
				_.unset(headers, 'referer');

				let reqOut: any = {
					url: targetUrl,
					method: vertex,
					body: ( req.body || null ),
					qs: req.transport != 'socket.io' ? req.query : req.body,
					json: true,
					headers: headers
				};

				let $request: any = sails.$request(req.session) || request;
				$request(reqOut, function (err: Error, message: any, body: any): void {

					console.log('*************************');
					console.log('' + vertex + ' ' + targetUrl);
					console.log('-------------------------');
					console.dir(headers);
					console.log('=========================');
					console.dir(body);

					if (params && body && !params.id && !_.isArray(body)) {
						body.id = body.id || uuid.v4();
						body = [body];
					}
					else if (_.isArray(body)) {
						_.each(body, function (item: any) {
							item.id = item.id || uuid.v4();
						});
					}

					if (!err) {
						res
							.status(message.statusCode)
							.send(body);
					}
					else {
						res.serverError(err);
					}
				})
			})
开发者ID:pmoelgaard,项目名称:nx-sails-swagger-api,代码行数:58,代码来源:index.ts


示例3: it

 it('should ignore ignoreProperties', () => {
     // set options (ignore Properties)
     eas.options = {
         ignoreProperties: ['data.ignored'], ignoreSubProperties: []
     };
     _.set(storage.testSnapObj, 'data.ignored', 'aVal');
     _.set(storage.testSnapObj2, 'data.ignored', 'aDifferentVal');
     // actual testing
     let result = eas.deepDiff(storage.testSnapObj, storage.testSnapObj2);
     expect(result).to.eql(storage.testDiffObj);
     // reset options to emtpy object
     eas.options = {};
     _.unset(storage.testSnapObj, 'data.ignored');
     _.unset(storage.testSnapObj2, 'data.ignored');
 });
开发者ID:hydra-newmedia,项目名称:chrobject,代码行数:15,代码来源:EntryAppServiceTest.ts


示例4:

 let unsetIgnoredSubProperties = (obj: any) => {
     if (_.isPlainObject(obj)) {
         for (var prop of this.options.ignoreSubProperties) {
             _.unset(obj, prop);
         }
     }
 };
开发者ID:hydra-newmedia,项目名称:chrobject,代码行数:7,代码来源:EntryAppService.ts


示例5:

 collections[collection].insert(doc, (err, newdoc) => {
   // docs
   if (err) {
     throw err;
   } else {
     _.unset(newdoc, '_id');
     return newdoc;
   }
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:9,代码来源:index.ts


示例6: makeActiveProject

export function makeActiveProject(projectDir: string, newActive: string): void {
  const activeProjects = configstore.get("activeProjects") || {};
  if (newActive) {
    activeProjects[projectDir] = newActive;
  } else {
    _.unset(activeProjects, projectDir);
  }
  configstore.set("activeProjects", activeProjects);
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:9,代码来源:utils.ts


示例7: resolve

 collections[collection].find(q).exec((err, docs) => {
   if (docs) {
     const l = docs.length;
     for (let i = 0; i < l; i += 1) {
       _.unset(docs[i], '_id');
     }
     resolve(docs);
   } else if (err) {
     reject(err);
   }
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:11,代码来源:index.ts


示例8: unsetConfigValue

export function unsetConfigValue(ctx: ConfigContext & { property: string; }): void {
  const conf = getConfig(ctx);

  if (ctx.global) { // Global config is flattened
    conf.unset(ctx.property);
  } else {
    const { c } = conf;
    lodash.unset(c, ctx.property);
    conf.c = c;
  }
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:11,代码来源:base.ts


示例9: return

 return (control: AbstractControl): { [key: string]: any } => {
   const ctrl1 = control.get(path1);
   const ctrl2 = control.get(path2);
   if (ctrl1.value !== ctrl2.value) {
     ctrl2.setErrors({ match: true });
   } else {
     const hasError = ctrl2.hasError('match');
     if (hasError) {
       // Remove the 'match' error. If no more errors exists, then set
       // the error value to 'null', otherwise the field is still marked
       // as invalid.
       const errors = ctrl2.errors;
       _.unset(errors, 'match');
       ctrl2.setErrors(_.isEmpty(_.keys(errors)) ? null : errors);
     }
   }
   return null;
 };
开发者ID:IlsooByun,项目名称:ceph,代码行数:18,代码来源:cd-validators.ts


示例10: setInstanceProps

  /**
   * 设置实例的 props 属性
   */
  @Action
  public setInstanceProps(instanceKey: string, key: string, value: any) {
    const instance = this.store.instances.get(instanceKey);
    const instanceClass = this.applicationStore.componentClasses.get(instance.gaeaKey);

    const defaultProps = this.applicationAction.getDefaultPropsByInstance(instance);

    // 如果和 defaultProps 相同,就把字段置空
    if (value === _.get(defaultProps, key)) {
      _.unset(instance.data.props, key);

      // 强制刷新组件
      this.eventAction.emit(`${this.eventStore.instanceUpdate}.${instanceKey}`);
      return;
    }

    _.set(instance.data, `props.${key}`, value);

    // 强制刷新组件
    this.eventAction.emit(`${this.eventStore.instanceUpdate}.${instanceKey}`);
  }
开发者ID:notejs,项目名称:gaea-editor,代码行数:24,代码来源:action.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.upperFirst函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.uniqueId函数代码示例发布时间: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