Files
hive/mcp-server/node_modules/lunr/lib/utils.js
anthonyrawlins e89f2f4b7b Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering:
- Project activation and management UI (#1-2)
- Worker node coordination and visualization (#3-4)
- Automated GitHub repository scanning (#5)
- Intelligent model-to-issue matching (#6)
- Multi-model task execution system (#7)
- N8N workflow integration (#8)
- Hive-Bzzz P2P bridge (#9)
- Peer assistance protocol (#10)

Each issue includes detailed specifications, acceptance criteria,
technical implementation notes, and dependency mapping.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:41:01 +10:00

93 lines
2.1 KiB
JavaScript

/*!
* lunr.utils
* Copyright (C) @YEAR Oliver Nightingale
*/
/**
* A namespace containing utils for the rest of the lunr library
* @namespace lunr.utils
*/
lunr.utils = {}
/**
* Print a warning message to the console.
*
* @param {String} message The message to be printed.
* @memberOf lunr.utils
* @function
*/
lunr.utils.warn = (function (global) {
/* eslint-disable no-console */
return function (message) {
if (global.console && console.warn) {
console.warn(message)
}
}
/* eslint-enable no-console */
})(this)
/**
* Convert an object to a string.
*
* In the case of `null` and `undefined` the function returns
* the empty string, in all other cases the result of calling
* `toString` on the passed object is returned.
*
* @param {Any} obj The object to convert to a string.
* @return {String} string representation of the passed object.
* @memberOf lunr.utils
*/
lunr.utils.asString = function (obj) {
if (obj === void 0 || obj === null) {
return ""
} else {
return obj.toString()
}
}
/**
* Clones an object.
*
* Will create a copy of an existing object such that any mutations
* on the copy cannot affect the original.
*
* Only shallow objects are supported, passing a nested object to this
* function will cause a TypeError.
*
* Objects with primitives, and arrays of primitives are supported.
*
* @param {Object} obj The object to clone.
* @return {Object} a clone of the passed object.
* @throws {TypeError} when a nested object is passed.
* @memberOf Utils
*/
lunr.utils.clone = function (obj) {
if (obj === null || obj === undefined) {
return obj
}
var clone = Object.create(null),
keys = Object.keys(obj)
for (var i = 0; i < keys.length; i++) {
var key = keys[i],
val = obj[key]
if (Array.isArray(val)) {
clone[key] = val.slice()
continue
}
if (typeof val === 'string' ||
typeof val === 'number' ||
typeof val === 'boolean') {
clone[key] = val
continue
}
throw new TypeError("clone is not deep and does not support nested objects")
}
return clone
}