This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default (fileInfo, api) => { | |
| const j = api.jscodeshift; | |
| const methods = []; | |
| const root = j(fileInfo.source); | |
| const body = root.find(j.Program).get('body', 0).node; | |
| const { comments } = body; | |
| delete body.comments | |
| root.get().node.comments = comments; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BirthdayGenerator | |
| def soon_to_be_celebrants | |
| User.ordered_by_soonest_birthday | |
| .where( birthday_month: 4.times.map{ |i| i.months.from_now.month } ) | |
| .where.not("birthday_month = :month AND birthday_day < :day", { month: Date.today.month, day: Date.today.day } ) | |
| end | |
| end |