Download react-transition-group/src/utils/SimpleSet.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 360 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-transition-group/src/utils/SimpleSet.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-transition-group/src/utils/SimpleSet.js
-
curl -L -o SimpleSet.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-transition-group/src/utils/SimpleSet.js
360 Bytes
| export default class SimpleSet { | |
| constructor() { | |
| this.v = []; | |
| } | |
| clear() { | |
| this.v.length = 0; | |
| } | |
| has(k) { | |
| return this.v.indexOf(k) !== -1; | |
| } | |
| add(k) { | |
| if (this.has(k)) return; | |
| this.v.push(k); | |
| } | |
| delete(k) { | |
| const idx = this.v.indexOf(k); | |
| if (idx === -1) return false; | |
| this.v.splice(idx, 1); | |
| return true; | |
| } | |
| } | |