lodash-es#isString TypeScript Examples
The following examples show how to use
lodash-es#isString.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UUIComponent.tsx From UUI with MIT License | 6 votes |
function compileNodes(options: any): any {
return mapValues(options.nodes, (nodeElement, nodeName) => {
if (isString(nodeElement)) {
return IntrinsicNode(nodeElement as any, nodeName, options)
} else {
return ComponentNode(nodeElement as any, nodeName, options)
}
})
}
Example #2
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function isDateOrString(value: any): value is Date | string {
return isDate(value) || isString(value);
}
Example #3
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function isNumberOrString(value: any): value is number | string {
return isNumber(value) || isString(value);
}
Example #4
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function isMapOrString(value: any): value is Map<any, any> | string {
return isMap(value) || isString(value);
}
Example #5
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function isStringOr2(value: any): value is string | 2 {
return isString(value) || value === 2;
}
Example #6
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function keyIsString(_: any, key: any): key is string {
return isString(key);
}
Example #7
Source File: test-utils.ts From s-libs with MIT License | 6 votes |
export function keyIsDateOrString(_: any, key: any): key is Date | string {
return isString(key) || isDate(key);
}
Example #8
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType number[]
reject(aOrU, isString);
Example #9
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// Value narrowing
// $ExpectType string[]
filter(o, isString);
Example #10
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType number[]
reject(aOrN, isString);
Example #11
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// Value narrowing
// $ExpectType (number | Date | Document)[]
reject(o, isString);
Example #12
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType (number | Date | Document)[]
reject(oOrU, isString);
Example #13
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType (number | Date | Document)[]
reject(oOrN, isString);
Example #14
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType number[]
reject(so, isString);
Example #15
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// narrowing
// $ExpectType Record<number, number>
omitBy(a, isString);
Example #16
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType Record<number, number>
omitBy(aOrU, isString);
Example #17
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType Record<number, number>
omitBy(aOrN, isString);
Example #18
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// value narrowing
// $ExpectType { a: number; c: Date | Document; }
omitBy(o, isString);
Example #19
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType { a: number; c: Date | Document; } | {}
omitBy(oOrU, isString);
Example #20
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType { a: number; c: Date | Document; } | {}
omitBy(oOrN, isString);
Example #21
Source File: omit-by.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType { [x: string]: Date | undefined; }
omitBy(record, isString);
Example #22
Source File: reject.dts-spec.ts From s-libs with MIT License | 5 votes |
// Narrowing
// $ExpectType number[]
reject(a, isString);
Example #23
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType string[]
filter(so, isString);
Example #24
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType string[]
filter(oOrN, isString);
Example #25
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType string[]
filter(oOrU, isString);
Example #26
Source File: Icon.tsx From UUI with MIT License | 5 votes |
Icon = UUIFunctionComponent({
name: 'Icon',
nodes: {
Root: 'div',
Container: 'div',
},
propTypes: IconPropTypes,
}, (props: IconFeatureProps, { nodes }) => {
const { Root, Container } = nodes
const finalProps = {
width: props.width || 24,
height: props.height || 24,
}
const content = (() => {
const size = { width: finalProps.width, height: finalProps.height }
switch (props.mode) {
case 'image':
return (
<Container>
<img src={props.source} alt={props.alt} style={{ ...size }} />
</Container>
)
case 'svg':
if (isString(props.source)) {
return <Container><img src={props.source} alt={props.alt} style={{ ...size }} /></Container>
} else {
return <Container><props.source {...props.svgrProps} {...size} /></Container>
}
case 'any':
return <Container>{props.source}</Container>
}
})()
return (
<Root role="image">
{content}
</Root>
)
})
Example #27
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType string[]
filter(aOrN, isString);
Example #28
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// $ExpectType string[]
filter(aOrU, isString);
Example #29
Source File: filter.dts-spec.ts From s-libs with MIT License | 5 votes |
// Narrowing
// $ExpectType string[]
filter(a, isString);