本文整理汇总了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;未经允许,请勿转载。 |
请发表评论