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

TypeScript lodash.isDate函数代码示例

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

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



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

示例1: deepDiff

 deepDiff(one: Object, two: Object, path: string = ''): IDeepDiff[] {
     let result: IDeepDiff[] = [];
     for (var key of _.keys(one)) {
         let concatPath: string = path ? path + '.' + key : key;
         if (_.isPlainObject(one[key])) {
             if (!_.has(two, key)) {
                 result.push(new DeepDiff('deleted', concatPath, one[key], null));
             } else {
                 result = _.concat(result, this.deepDiff(one[key], two[key], path ? path + '.' + key : key));
             }
         } else if (_.isBoolean(one[key]) || _.isDate(one[key]) || _.isNumber(one[key])
             || _.isNull(one[key]) || _.isRegExp(one[key]) || _.isString(one[key])) {
             if (!_.has(two, key)) {
                 result.push(new DeepDiff('deleted', concatPath, one[key], null));
             } else if (_.get(one, key) !== _.get(two, key)) {
                 result.push(new DeepDiff('edited', concatPath, one[key], two[key]));
             }
         } else if (_.isArray(one[key]) && _.isArray(two[key]) && !_.isEqual(one[key], two[key])) {
             result.push(new DeepDiff('array', concatPath, one[key], two[key]));
         } else if (!_.has(two, key)) {
             result.push(new DeepDiff('deleted', concatPath, one[key], null));
         }
     }
     for (var key of _.keys(two)) {
         let concatPath: string = path ? path + '.' + key : key;
         if (!_.has(one, key)) {
             if (_.isPlainObject(two[key]) || _.isBoolean(two[key]) || _.isDate(two[key]) || _.isNumber(two[key])
                 || _.isNull(two[key]) || _.isRegExp(two[key]) || _.isString(two[key]) || _.isArray(two[key])) {
                 result.push(new DeepDiff('created', concatPath, null, two[key]));
             }
         }
     }
     return result;
 }
开发者ID:fyyyyy,项目名称:chrobject,代码行数:34,代码来源:EntryAppService.ts


示例2: unsetIgnoredSubProperties

        _.keys(one).forEach((key) => {
            let concatPath: string = path ? path + '.' + key : key;
            if (!_.includes(this.options.ignoreProperties, concatPath) && !_.includes(this.options.ignoreSubProperties, concatPath)) {

                unsetIgnoredSubProperties(one[key]);
                unsetIgnoredSubProperties(two[key]);

                let getDeletedProperties = (obj: any, propPath: string = null) => {
                    if (_.isPlainObject(obj)) {
                        for (var objKey of _.keys(obj)) {
                            unsetIgnoredSubProperties(obj[objKey]);
                            getDeletedProperties(obj[objKey], propPath ? propPath + '.' + objKey : objKey);
                        }
                    } else if (_.isBoolean(obj) || _.isDate(obj) || _.isNumber(obj)
                        || _.isNull(obj) || _.isRegExp(obj) || _.isString(obj) || _.isArray(obj)) {
                        result.push(new DeepDiff('deleted', propPath, obj, null));
                    }
                };

                if (_.isPlainObject(one[key])) {
                    if (!_.has(two, key)) {
                        getDeletedProperties(one[key], concatPath);
                    } else {
                        result = _.concat(result, this.deepDiff(one[key], two[key], path ? path + '.' + key : key));
                    }
                } else if (_.isBoolean(one[key]) || _.isDate(one[key]) || _.isNumber(one[key])
                    || _.isNull(one[key]) || _.isRegExp(one[key]) || _.isString(one[key])) {
                    if (!_.has(two, key)) {
                        result.push(new DeepDiff('deleted', concatPath, one[key], null));
                    } else if (_.isDate(one[key]) || _.isDate(two[key])) {
                        if (new Date(one[key]).valueOf() !== new Date(two[key]).valueOf()) {
                            result.push(new DeepDiff('edited', concatPath, new Date(one[key]), new Date(two[key])));
                        }
                    } else if (hash(one[key]) !== hash(two[key])) {
                        result.push(new DeepDiff('edited', concatPath, one[key], two[key]));
                    }
                } else if (_.isArray(one[key]) && _.isArray(two[key]) && !_.isEqual(one[key], two[key])) {
                    for (var i = 0; i < one[key].length; i++) {
                        unsetIgnoredSubProperties(one[key][i]);
                    }
                    for (var i = 0; i < two[key].length; i++) {
                        unsetIgnoredSubProperties(two[key][i]);
                    }
                    if (hash(one[key]) !== hash(two[key])) {
                        result.push(new DeepDiff('array', concatPath, one[key], two[key]));
                    }
                } else if (!_.has(two, key)) {
                    getDeletedProperties(one[key], concatPath);
                }
            }
        });
开发者ID:hydra-newmedia,项目名称:chrobject,代码行数:51,代码来源:EntryAppService.ts


示例3: parse

export function parse(text, roundUp?) {
  if (!text) { return undefined; }
  if (moment.isMoment(text)) { return text; }
  if (_.isDate(text)) { return moment(text); }

  var time;
  var mathString = '';
  var index;
  var parseString;

  if (text.substring(0, 3) === 'now') {
    time = moment();
    mathString = text.substring('now'.length);
  } else {
    index = text.indexOf('||');
    if (index === -1) {
      parseString = text;
      mathString = ''; // nothing else
    } else {
      parseString = text.substring(0, index);
      mathString = text.substring(index + 2);
    }
    // We're going to just require ISO8601 timestamps, k?
    time = moment(parseString);
  }

  if (!mathString.length) {
    return time;
  }

  return parseDateMath(mathString, time, roundUp);
}
开发者ID:eddawley,项目名称:grafana,代码行数:32,代码来源:datemath.ts


示例4: function

  format: function(date, mask) {
    assert(_.isDate(date),
      'DateFormatting.format: the first argument is required and has to be a JS Date instance');
    assert(_.isString(mask),
      'DateFormatting.format: the second argument is required and has to be a string representing the date format mask to represent date as');

    return moment(date).format(mask);
  },
开发者ID:gurdiga,项目名称:xo,代码行数:8,代码来源:DateFormatting.ts


示例5: it

    it('works for the happy path', function() {
      assert(_.isDate(date),
        'parses the string given as the first argument according' +
        ' to the string mask passed in the second argument and returns a date object');

      assert.equal(date.getDate(), 7, 'returned date has the appropriate date');
      assert.equal(date.getMonth(), 5, 'returned date has the appropriate month');
      assert.equal(date.getFullYear(), 2015, 'returned date has the appropriate year');
    });
开发者ID:gurdiga,项目名称:xo,代码行数:9,代码来源:DateFormattingTest.ts


示例6: CompletionLabel

export function CompletionLabel(completionTime) {
  assert(_.isDate(completionTime), 'CompletionLabel expects the completionTime argument to be a Date object');

  var domElement = createElement();
  WidgetRole.apply(this, [domElement]);

  addContent(domElement, completionTime);

  this.getData = delegateTo(completionTime, 'toISOString');
}
开发者ID:gurdiga,项目名称:xo,代码行数:10,代码来源:CompletionLabel.ts


示例7: Date

app.get('/',(req,res)=>{
    var q = req.query.q;

    var ss = _.isDate(new Date());

    console.log("ss:",ss);

    var md5Value = utility.md5(q);
    res.send(md5Value);
});
开发者ID:wangyibu,项目名称:node-lessons,代码行数:10,代码来源:app.ts


示例8:

      val.forEach((v: any) => {
        if (isObject(v)) {
          if (isDate(v)) {
            v = (v as Date).toISOString();
          } else {
            v = JSON.stringify(v);
          }
        }

        parts.push(`${UrlBuilderUtils.encodeUriQuery(key)}=${UrlBuilderUtils.encodeUriQuery(v)}`);
      });
开发者ID:mizzy,项目名称:deck,代码行数:11,代码来源:urlBuilder.service.ts


示例9: it

 it('takes two date for range.', () => {
     const d1 = new Date(1999, 1, 1);
     const d2 = new Date(2000, 3, 22);
     const d3 = date.choose({ start: d1, end: d2 }).random;
     const inRange = () => {
         const t1 = d1.getTime();
         const t2 = d2.getTime();
         const t3 = d3.getTime();
         return t1 <= t3 && t3 <= t2;
     };
     return isDate(d3) && inRange();
 });
开发者ID:hychen,项目名称:hycheck,代码行数:12,代码来源:datetime.test.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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