New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-fzf

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fzf - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

4

bin/cli.js

@@ -37,3 +37,3 @@ #!/usr/bin/env node

const opts = {
mode: normalMode ? 'normal' : 'fzf',
mode: normalMode ? 'normal' : 'fuzzy',
list: files

@@ -55,3 +55,3 @@ }

const opts = {
mode: normalMode ? 'normal' : 'fzf',
mode: normalMode ? 'normal' : 'fuzzy',
list: [] // stdin will update it later

@@ -58,0 +58,0 @@ }

{
"name": "node-fzf",
"version": "0.4.0",
"version": "0.4.1",
"description": "fzf ( junegunn/fzf ) inspired cli utility for node",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -24,5 +24,42 @@ [![npm](https://img.shields.io/npm/v/node-fzf.svg?maxAge=3600&style=flat-square)](https://www.npmjs.com/package/node-fzf)

#### API usage
##### promises
```js
const nfzf = require( 'node-fzf' )
const opts = {
list: [ 'whale', 'giraffe', 'monkey' ]
}
;( async function () {
// opens interactive selection CLI
// note! this messes with stdout so if you are
// writing to stdout at the same time it will look a bit messy..
const result = await nfzf( opts )
const { selected, query } = result
if( !selected ) {
console.log( 'No matches for:', query )
} else {
console.log( selected.value ) // 'giraffe'
console.log( selected.index ) // 1
console.log( selected.value === opts.list[ selected.index ] ) // true
}
} )()
// can also add more items later..
setInterval( function () {
opts.list.push( 'foobar' )
// an .update method has been attached to the object/array
// that you gave to nfzf( ... )
opts.update( list )
}, 1000 )
```
##### callbacks
```js
const nfzf = require( 'node-fzf' )
const list = [ 'whale', 'giraffe', 'monkey' ]

@@ -34,3 +71,3 @@

const api = nfzf( list, function ( result ) {
const { selected, query } = result;
const { selected, query } = result
if( !selected ) {

@@ -42,2 +79,7 @@ console.log( 'No matches for:', query )

console.log( selected.value === list[ selected.index ] ) // true
// the api is a reference to the same argument0 object
// with an added .update method attached.
console.log( list === api ) // true
console.log( list.update === api.update ) // true
}

@@ -52,6 +94,2 @@

}, 1000 )
// if you don't need the api returned by nfzf you can use
// promises to await for the result only
const result = await nfzf( list )
```

@@ -58,0 +96,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc