Skip to content

Commit

Permalink
fix: compatibility with node 20
Browse files Browse the repository at this point in the history
Fixes #47
  • Loading branch information
borisdiakur committed Feb 7, 2024
1 parent e0626f4 commit 77143f4
Show file tree
Hide file tree
Showing 6 changed files with 1,419 additions and 1,632 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 4.0.1 (2024-02-07)
* fix: support node 20

### 4.0.0 (2023-02-12)
* BREAKING CHANGE: drop support for ancient node versions (< 18)

Expand Down
17 changes: 9 additions & 8 deletions lib/n_.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ function injectLodashIntoRepl(server, lodashes, promptConfig, c) {
repl.log(
[
`${c.bold[helpColor]('.lodash')} enables you to configure the ${c.bold(
'_'
'_',
)} lodash instance of n_ repl, here are the available sub-commands:`,
...Object.entries(commandHelps).map(
([command, help]) =>
`- ${c.bold[helpColor](command)}: ${help.replace('_', c.bold('_'))}`
`- ${c.bold[helpColor](command)}: ${help.replace('_', c.bold('_'))}`,
),
].join('\n')
].join('\n'),
),
}

Expand All @@ -138,8 +138,8 @@ function injectLodashIntoRepl(server, lodashes, promptConfig, c) {
if (!handler)
this.log(
`there is no '${c.bold.red(
subcommand
)}' sub-command, see available ones with '.lodash ${c.bold[helpColor]('help')}'`
subcommand,
)}' sub-command, see available ones with '.lodash ${c.bold[helpColor]('help')}'`,
)
else handler(this)
}
Expand Down Expand Up @@ -200,8 +200,9 @@ function wrapRepl(args, c) {
replHistory(server, completeArgs.historyPath)

// create new pristine `lodash` instance
const lodashVanilla = require('lodash').runInContext(server.context)
const lodashFunctional = require('lodash/fp').runInContext(server.context)
const ld = require('lodash')
const lodashVanilla = ld.runInContext.apply(global, server.context)
const lodashFunctional = require('lodash/fp').runInContext.apply(global, server.context)

injectLodashIntoRepl(
server,
Expand All @@ -211,7 +212,7 @@ function wrapRepl(args, c) {
initial: args.fp ? 'fp' : 'vanilla',
},
promptConfig,
c
c,
)

return server
Expand Down
Loading

0 comments on commit 77143f4

Please sign in to comment.