本文整理匯總了TypeScript中Immutable.Iterable.isIterable方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Iterable.isIterable方法的具體用法?TypeScript Iterable.isIterable怎麽用?TypeScript Iterable.isIterable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Immutable.Iterable
的用法示例。
在下文中一共展示了Iterable.isIterable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const stateTransformer = (state) => {
const newState = {};
for (let i of Object.keys(state)) {
newState[i] = Iterable.isIterable(state[i]) ? state[i].toJS() : state[i];
}
return newState;
};
示例2: stateTransformer
function stateTransformer(state) {
const newState = {};
for (const i of Object.keys(state)) {
newState[i] = Iterable.isIterable(state[i]) ? state[i].toJS() : state[i];
}
return newState;
}
示例3:
stateTransformer: (state) => {
let newState = {};
for (let i of Object.keys(state)) {
if (Iterable.isIterable(state[i])) {
newState[i] = state[i].toJS();
} else {
newState[i] = state[i];
}
};
return newState;
}
示例4: Object
state => {
const newState = new Object();
for (const i of Object.keys(state)) {
newState[i] = Iterable.isIterable(state[i])
? state[i].toJS()
: state[i];
};
return newState;
}
示例5:
return Object.keys(state).reduce((newState, key) => {
const val = state[key];
newState[key] = Iterable.isIterable(val) ? val.toJS() : val;
return newState;
}, {});
示例6: it
it('should have an immutable initial state', () => {
expect(Iterable.isIterable(initState)).toBe(true);
});