Download pool/shard007/JavaScript/0044057_FileName.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard007/JavaScript/0044057_FileName.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard007/JavaScript/0044057_FileName.js
-
curl -L -o 0044057_FileName.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard007/JavaScript/0044057_FileName.js
1.41 kB
| "use babel"; | |
| const Metadata = require('lupa').Metadata; | |
| const getMetadata = Metadata.getMetadata; | |
| const getLines = (f) => { | |
| const item = getMetadata(f).filter((item) => item.type == 'lines')[0] || {} | |
| return item.data || 0; | |
| } | |
| const React = require('react'); | |
| const div = React.createFactory('div'); | |
| const span = React.createFactory('span'); | |
| const LineCount = require('./LineCount'); | |
| class FileName extends React.Component { | |
| render() { | |
| const f = this.props.file; | |
| const preview = this.props.preview; | |
| const onClick = () => { | |
| // if !fs.existsSync(path) | |
| // path = getFileForRequire(allFiles, path).path | |
| preview.getBuffer().setPath(f.path) | |
| preview.setText(f.contents + ''); | |
| console.log("ON CHANGEX", this.props.onChange, this.props.line) | |
| this.props.onChange && this.props.onChange(this.props.line); | |
| preview.scrollToBufferPosition([this.props.line || 0, 0]); | |
| //atom.workspace.open(f.path, {initialLine: this.props.line || 0}); | |
| }; | |
| return div({className: 'lupa-file', onClick: onClick}, [ | |
| this.props.desc? <span> | |
| {this.props.desc} | |
| <span style={{fontSize: 8}}>{f.path}</span> | |
| </span> : f.path, | |
| React.createElement(LineCount, {lines: getLines(f)}) | |
| ]) | |
| } | |
| } | |
| module.exports = FileName; | |