# search-context **Repository Path**: mirrors_dominictarr/search-context ## Basic Information - **Project Name**: search-context - **Description**: show the context around a match for a search query - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # search-context Show where a query matches a document. # example ``` js var context = require('search-context') var fs = require('fs') var README = fs.readFileSync(__dirname + '/README.md', 'utf-8') function hi (string) { return '***'+string.toUpperCase()+'***' } console.log( context(README, ['query', 'document', 'search'], 80, hi) ) ``` `hi` is an optional function that marks the matched string. By default it applies bold ansi escape to display in the terminal. ## output `search-context` finds the tightest occurance of the terms in the query. If the terms are far apart, the context around each term is displayed with ... joining them. ## License MIT