Skip to content

Instantly share code, notes, and snippets.

View in4lio's full-sized avatar
:octocat:
(눈‸눈)

Vitaly Kravtsov in4lio

:octocat:
(눈‸눈)
  • Karlsruhe, Germany
View GitHub Profile
@in4lio
in4lio / hn_search.js
Last active September 19, 2023 06:56 — forked from meiamsome/hn_search.js
hn job query search
// Takes arguments and produces an array of functions that accept context.
function handle_args() {
var args = Array.prototype.slice.call(arguments);
return args.map(function(arg) {
if (arg instanceof Function) return arg; // Presumably already a contex-accepting function.
if (arg instanceof Array) return and.apply(this, arg); // Make arrays behave as and.
// Presuming a string, build a function to check.
var my_regex = new RegExp(arg.toString(), 'i');
return function(context) {
return context.search(my_regex) > -1;