TK
wtf.reduce(reducer, initial)
actions.reduce(reducer, initAction)
Size: a a a
TK
wtf.reduce(reducer, initial)
actions.reduce(reducer, initAction)
m
// makeBreakpointsProcess :: Object -> Array
export const makeBreakpointsProcess = config =>
Array.prototype.concat
.call([], createBreakpoints(config))
.map(toPxValue)
.map(basePropProcess)
.reduce(inheritProps, [])
.map(
R.compose(
setPropRoot,
calcRatioProcess,
),
);
m
m
m
К
actions.reduce(reducer, initAction)
m
К
К
К
m
m
К
Stream<string>
. В каждом значении может встречаться символ, который считается разделителем. Задача состоит в том, чтобы создать. новый стрим, в котором новые значения созданы из старых с использованием разделителя. Например, у нас есть стрим:from([
'123 456',
'789 0',
])
from([
'123',
'456789',
'0',
])
К
AK
К
К
from([
'ABCD\nEFGH',
'wtf',
'IJKL\nMNOP',
'QRST\nUVWX',
])
.scan(
(acc, data: string) => {
const rows = data.split('\n')
const queue = rows.slice(0, -1)
const lastRow = last(rows) || ''
if (queue.length) {
queue[0] = acc.buff + queue[0]
acc.queue = queue
acc.buff = ''
} else {
acc.queue = []
}
if (data.endsWith('\n')) {
acc.queue.push(
`${acc.buff}${lastRow}`,
)
} else {
acc.buff += lastRow
}
return acc
},
{ buff: '', queue: [] },
)
.chain(acc => from(acc.queue))
.subscribe({
next: console.log,
})
AK
К