Download spectrum/api/migrations/20170701173337-linkify-messages.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/migrations/20170701173337-linkify-messages.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/migrations/20170701173337-linkify-messages.js
-
curl -L -o 20170701173337-linkify-messages.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/migrations/20170701173337-linkify-messages.js
763 Bytes
| const markdownLinkify = require('../utils/markdown-linkify'); | |
| exports.up = function(r, conn) { | |
| return ( | |
| // Markdown linkify each message | |
| r | |
| .table('messages') | |
| .withFields('id', 'content') | |
| .run(conn) | |
| .then(cursor => cursor.toArray()) | |
| .then(messages => | |
| Promise.all( | |
| messages.map(message => | |
| r | |
| .table('messages') | |
| .get(message.id) | |
| .update({ | |
| content: { | |
| body: markdownLinkify(message.content.body), | |
| }, | |
| }) | |
| .run(conn) | |
| ) | |
| ) | |
| ) | |
| ); | |
| }; | |
| exports.down = function(r, conn) { | |
| // Can't really undo just this change so we don't bother | |
| return Promise.resolve(); | |
| }; | |