consolidation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Tool utility functions for consistent tool operations across the app
|
||||
* CONSOLIDATED Tool utility functions for consistent tool operations across the app
|
||||
* Works in both server (Node.js) and client (browser) environments
|
||||
*/
|
||||
|
||||
export interface Tool {
|
||||
@@ -65,4 +66,26 @@ export function getToolCategory(tool: Tool): 'concept' | 'method' | 'hosted' | '
|
||||
if (isToolHosted(tool)) return 'hosted';
|
||||
if (tool.license && tool.license !== 'Proprietary') return 'oss';
|
||||
return 'proprietary';
|
||||
}
|
||||
|
||||
// BROWSER COMPATIBILITY LAYER
|
||||
// Only assign to window if we're in a browser environment
|
||||
if (typeof window !== 'undefined') {
|
||||
// Make functions available globally for existing code compatibility
|
||||
window.createToolSlug = createToolSlug;
|
||||
window.findToolByIdentifier = findToolByIdentifier;
|
||||
window.isToolHosted = isToolHosted;
|
||||
|
||||
console.log('[toolHelpers] Consolidated tool utilities loaded and assigned to window');
|
||||
}
|
||||
|
||||
// LEGACY NODE.JS COMPATIBILITY
|
||||
// Support for older require() patterns if needed
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = {
|
||||
createToolSlug,
|
||||
findToolByIdentifier,
|
||||
isToolHosted,
|
||||
getToolCategory
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user