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


TypeScript lodash.isRegExp函數代碼示例

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


在下文中一共展示了isRegExp函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: isMatchPath

function isMatchPath(path, arr):boolean{
    for(let item of arr){
      if(_.isString(item) && path === item){
        return true
      }
      if(_.isRegExp(item) && item.test(path)){
        return true
      }
    }
    return false
}
開發者ID:huyinghuan,項目名稱:waterpit,代碼行數:11,代碼來源:filter.ts

示例3: unsetIgnoredSubProperties

 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));
     }
 };
開發者ID:hydra-newmedia,項目名稱:chrobject,代碼行數:11,代碼來源:EntryAppService.ts

示例4: function

Assertion.addMethod('toLocation', function (location: string | RegExp) {
  const res = this._obj

  if (_.isRegExp(location)) {
    this.assert(
      location.test(res.header['location'])
      , errorMessageWithResponseExtract('expected redirect location to match #{exp} pattern but got #{act}', res)
      , errorMessageWithResponseExtract('expected redirect location to not match #{act}', res)
      , location.source // expected
      , res.header['location'] // actual
    )
  } else {
    this.assert(
      res.header['location'] === location
      , errorMessageWithResponseExtract('expected redirect location to be #{exp} but got #{act}', res)
      , errorMessageWithResponseExtract('expected redirect location to not be #{act}', res)
      , location // expected
      , res.header['location'] // actual
    )
  }
})
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:21,代碼來源:expectations.ts

示例5: isRegExp

export const regexp = (value: any): value is number => isRegExp(value)
開發者ID:bcherny,項目名稱:tassert,代碼行數:1,代碼來源:tassert.ts

示例6: describe

        describe('before copying', () => {

            it('should be waiting', () => {
                expect(component.isWaiting()).to.eventually.be.true;
            });

            it('should not be successful', () => {
                expect(component.isSuccessful()).to.eventually.be.false;
            });

            it('should not have failed', () => {
                expect(component.isFailure()).to.eventually.be.false;
            });

            if (options.expectedText) {
                if (_.isString(options.expectedText)) {
                    it('should have the expected text', () => {
                        expect(component.getText()).to.eventually.eq(options.expectedText);
                    });
                }

                if (_.isRegExp(options.expectedText)) {
                    it('should match the expected text', () => {
                        expect(component.getText()).to.eventually.match(options.expectedText);
                    });
                }
            }

            it('should have a tooltip informing users to click to copy', () => {
                expect(component.tooltip.getText()).to.eventually.eq('Click to Copy');
            });

            // Skip on Chrome for Mac: CMD-V is not working to paste clipboard contents
            if (options.testCopyArea && !(browser.params.isMac && browser.params.isChrome)) {
                it('should copy text to clipboard', () => {
                    component.copy();
                    getPastedValue().then(pastedValue => {
                        expect(component.getText()).to.eventually.eq(pastedValue);
                    });
                });
            }

            describe('after copy', () => {
                before(() => {
                    component.copy();
                });

                it('should not be waiting', () => {
                    expect(component.isWaiting()).to.eventually.be.false;
                });

                it('should be successful', () => {
                    expect(component.isSuccessful()).to.eventually.be.true;
                });

                it('should not have failed', () => {
                    expect(component.isFailure()).to.eventually.be.false;
                });

                it ('should have success tooltip', () => {
                    expect(component.tooltip.getText()).to.eventually.eq('Copied!');
                });

                describe('and after a short wait', () => {
                    before(() => {
                        browser.sleep(3000);
                    });

                    it('should be waiting', () => {
                        expect(component.isWaiting()).to.eventually.be.true;
                    });

                    it('should not be successful', () => {
                        expect(component.isSuccessful()).to.eventually.be.false;
                    });

                    it('should not have failed', () => {
                        expect(component.isFailure()).to.eventually.be.false;
                    });

                    it('should have default tooltip', () => {
                        expect(component.tooltip.getText()).to.eventually.eq('Click to Copy');
                    });
                });
            });
        });
開發者ID:Droogans,項目名稱:encore-ui,代碼行數:86,代碼來源:rxCopy.exercise.ts


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