ReactJS
1import {Simulate} from "react-dom/test-utils";
2import {preventDefault} from "../utils/react/preventDefault";
3import {stopPropagation} from "../utils/react/stopPropagation";
4import input = Simulate.input;
5import {getValue} from "../utils/react/pickFromSyntheticEvent";
6import {pipe} from "../utils/react/pipe";
7import {pick} from "../utils/react/pick";
8import {isEqual} from "../utils/react/isEqual";
9import React from "react";
10
11export function InputExample({value, onChange}: any) {
12return (
13<div>
14<input
15value={value}
16onChange={preventDefault(stopPropagation(getValue(onChange)))}
17/>
18</div>
19);
20}
21
22const comments = [{id:22,text:"dd"}]
23
24const createFilterBy = (prop: string) =>(id: any) => pipe(pick(prop), isEqual(id),cond)
25const filterById = createFilterBy('id');
26const filterByValue = createFilterBy("value");
27
28const filteredComments = comments.filter(filterById(22));
29
30function cond(b: boolean) {
31return !b;
32}
33
34const getValueNumber = pipe<number>(
35pick("currentTarget"),
36pick("value"),
37parseInt
38);