本文整理汇总了TypeScript中lodash/defaults.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ellipsis
ellipsis(options={}){
this.push(defaults({
key: "ellipsis-" + this.pages.length,
label: '...',
disabled: true
}, options))
}
示例2: next
next(options={}){
this.push(defaults({
key: "next",
label: this.translate('pagination.next'),
page: this.currentPage < this.totalPages - 1 ? (this.currentPage + 1) : undefined,
disabled: this.currentPage === this.totalPages
}, options))
}
示例3: previous
previous(options={}){
this.push(defaults({
key: "previous",
label: this.translate('pagination.previous'),
page: this.currentPage > 1 ? (this.currentPage - 1) : undefined,
disabled: this.currentPage === 1
}, options))
}
示例4: page
page(pageNumber, options={}){
if (pageNumber > 0 && pageNumber <= this.totalPages){
this.push(defaults({
key: pageNumber,
label: '' + pageNumber,
page: pageNumber,
active: pageNumber == this.currentPage
}, options))
}
}
示例5: setupBasicContainer
export default function setupBasicContainer(options = {}) {
options = defaults(options, {
'orm-adapter:memory': MemoryAdapter,
'serializer:application': FlatSerializer,
'config:environment': { ormAdapter: 'memory' }
});
let container = new Container();
forIn(options, (value, key) => {
container.register(key, value);
});
return container;
}
示例6: renderComponent
export function renderComponent(component:RenderComponentType<any>, props={}, children=null){
if (component["prototype"] instanceof React.Component || (component["prototype"] && component["prototype"].isReactComponent)){
return React.createElement(component as React.ComponentClass<any>, props, children)
} else if (React.isValidElement(component)){
return React.cloneElement(component as Element, props, children);
} else if ((typeof component) === 'function'){
const funProps = (children != null) ? defaults(props, {children}) : props
return React.createElement(FunctionComponent, {
key: props["key"],
fun: component,
props: funProps
})
}
console.warn("Invalid component", component)
return null
}
示例7: defaults
export const prepareConfig = (defaultConfig: ReporterConfig, overrides?: ReporterConfig): ReporterConfig => {
const config: ReporterConfig = defaults({}, overrides, defaultConfig, {
newLine: EOL,
padding: 2,
});
if (typeof config.transformHeader !== 'function') {
throw new TypeError('transformHeader must be a function');
}
if (typeof config.transformComment !== 'function') {
throw new TypeError('transformComment must be a function');
}
// padding must be a minimum of 0
// enforce padding to be a number as well
config.padding = Math.max(0, config.padding);
return config;
};
示例8: defaults
orderDirection?: string
include?: Array<string> | string
exclude?: Array<string> | string
showCount?: boolean
showMore?:boolean
}
export const FacetFilterPropTypes = defaults({
field: React.PropTypes.string.isRequired,
operator: React.PropTypes.oneOf(["AND", "OR"]),
size: React.PropTypes.number,
title: React.PropTypes.string.isRequired,
id: React.PropTypes.string.isRequired,
containerComponent:RenderComponentPropType,
listComponent:RenderComponentPropType,
itemComponent:RenderComponentPropType,
translations: SearchkitComponent.translationsPropType(
FacetAccessor.translations
),
orderKey: React.PropTypes.string,
orderDirection: React.PropTypes.oneOf(["asc", "desc"]),
include: React.PropTypes.oneOfType([
React.PropTypes.string, React.PropTypes.array
]),
exclude: React.PropTypes.oneOfType([
React.PropTypes.string, React.PropTypes.array
]),
showCount: React.PropTypes.bool,
showMore: React.PropTypes.bool
},SearchkitComponent.propTypes)
示例9: defaults
export const FacetFilterPropTypes = defaults({
field: React.PropTypes.string.isRequired,
operator: React.PropTypes.oneOf(["AND", "OR"]),
size: React.PropTypes.number,
title: React.PropTypes.string.isRequired,
id: React.PropTypes.string.isRequired,
containerComponent:RenderComponentPropType,
listComponent:RenderComponentPropType,
itemComponent:RenderComponentPropType,
translations: SearchkitComponent.translationsPropType(
FacetAccessor.translations
),
orderKey: React.PropTypes.string,
orderDirection: React.PropTypes.oneOf(["asc", "desc"]),
include: React.PropTypes.oneOfType([
React.PropTypes.string, React.PropTypes.array
]),
exclude: React.PropTypes.oneOfType([
React.PropTypes.string, React.PropTypes.array
]),
showCount: React.PropTypes.bool,
showMore: React.PropTypes.bool,
fieldOptions:React.PropTypes.shape({
type:React.PropTypes.oneOf(["embedded", "nested", "children"]).isRequired,
options:React.PropTypes.object
}),
countFormatter:React.PropTypes.func,
bucketsTransform:React.PropTypes.func
},SearchkitComponent.propTypes)