@anonymous/

UprightTepidLead

Nodejs

No description

fork
loading
Files
  • index.js
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const {
  ap,
  curry,
  findIndex,
  gte,
  identity,
  propEq,
  remove,
  when,
} = require ('ramda')

const { ifElse, flip, } = require('crocks')

const mystate = [
  { idx: 87, name: 'Hello' },
  { idx: 54, name: 'World' }
]

const removeOne = curry ( (idx, list) => remove (idx) (1) (list) )
const safeRemoveOne = ifElse (flip (gte) (0)) (removeOne) (_ => identity)

const timelineDelete = (state, idx) =>
  ap
    (flip (safeRemoveOne))
    (findIndex (propEq ('idx') (idx)))
    (state)

timelineDelete (mystate, 54)
node v10.16.0