export function load() { if (typeof localStorage !== "undefined") { const serialized = localStorage.getItem("todos"); if (serialized) { const items = Seq(JSON.parse(serialized)) .map(item => new TodoItem(item)) .toList(); return new TodoApp({items}); } } return new TodoApp(); }
(0, _immutable.Range)(1, totalOfPages + 1).filter(function (item) { return item <= 3 && page < 3 || item <= page + 1 && item >= page - 1 || item > totalOfPages - 3; }).map(function (item) { return _react2.default.createElement( PaginationButton, { active: item == page, disabled: item == page, key: 'page.' + item, onClick: _this7.goToPage(item) }, item ); }).toJS()
function createRows ( size ) { return I.Range( 0, size ).map(function ( idx ) { return I.Map({ id : 'record_' + idx, author : faker.name.findName(), notes : faker.lorem.sentence(), profession : faker.random.array_element([ 'dev', 'qa', 'ban', 'san' ]) }); }).toList(); }
export default function (todos=init, action) { switch (action.type) { case 'ADD_TODO': return todos.push(Map(action.payload)); case 'TOGGLE_TODO': return todos.map(item => { if (item.get('id') === action.payload) { return item.update('isDone', isDone => !isDone); } else { return item; } }) default: return todos; } }
const TodoList = ({ todos, onRemove, category, onMove }: Props): React.Element<any> => ( <div className={styles.root}> <div className={styles.inner}> <h2>{todos.count()} todos in category {category}</h2> <ul> {todos.map((todo: TodoType): React.Element<any> => ( <Todo key={todo.id} onRemove={onRemove} onMove={onMove} todo={todo} /> ))} </ul> </div> </div> )
export function mapToJsArray(entities: $$Map<any, any> | $$Set<any>) { // eslint-disable-next-line no-confusing-arrow return entities.map($$entity => $$entity.toJS ? $$entity.toJS() : $$entity).toArray(); }
var ishave = state.some(f => f.get('addtional') === action.addtional); if (ishave) { return state.map(f => { if (f.get('addtional') === action.addtional) { return f.set('count', f.get('count') + action.count); ); case 'REDUCE_COUNT': return state.map(f => { if (f.get('addtional') === action.addtional) { if (f.get('count') > 1) {
const TodoLists = (props: Props) => { const { onRemove, onMove, todos } = props; return ( <div className={styles.root}> {Range(0, 3).map(category => ( <TodoList key={category} category={categoryNames[category]} onRemove={onRemove} onMove={onMove} todos={todos.filter(todo => todo.category === category).sortBy(todo => todo.text)} /> ))} </div> ); }
createSelector( operations, consumes, produces, (operations, consumes, produces) => { return operations.map(ops => ops.update("operation", op => { if (op) { if (!Map.isMap(op)) { return } return op.withMutations(op => { if (!op.get("consumes")) { op.update("consumes", a => Set(a).merge(consumes)) } if (!op.get("produces")) { op.update("produces", a => Set(a).merge(produces)) } return op }) } else { // return something with Immutable methods return Map() } })) } )
todoList = todoList.map(function(todo) { return new Todo({ title: todo.title,
export function listOfMapsToJsArray(list: $$List<$$Map<any, any>>) { return list.map($$map => $$map.toJS()).toArray(); }
(0, _immutable.Range)(1, totalOfPages + 1).filter(function (item) { return item <= 3 && page < 3 || item <= page + 1 && item >= page - 1 || item > totalOfPages - 3; }).map(function (item) { return _react2.default.createElement( PaginationButton, { active: item == page, disabled: item == page, key: 'page.' + item, onClick: _this7.goToPage(item) }, item ); }).toJS()
export default function(todos=init, action) { switch(action.type) { case 'ADD_TODO': return todos.push(Map(action.payload)); case 'TOGGLE_TODO': return todos.map(t => { if(t.get('id') === action.payload) { return t.update('isDone', isDone => !isDone); } else { return t; } }); default: return todos; } }