diff --git a/README.md b/README.md index bd7f5ac..6509a8f 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,11 @@ The naming of functions is important. There are basically two styles: The task file function use the first style. The name of function starts with the action followed by the object. The object definition can be singular and/or plural. -**Examples for actions**: activate, install, dev, develop, init, build, start, update, remove, delete, enable, disable, template, convert, create, edit, change, get, set, patch, fetch, generate, push, pull, import, export, list, publish, release, test, setup, prepare, restart, stop, store, restore, translate, upgrade, zip, visualize, sync, switch, run, reset, load, dump, checkout, commit, drop, deploy, handle, trigger, render, lint, uninstall, split, parse, fix, refactor, chore, style, cat, ls, rm, serve, help, show, filter, limit, login, logout, encrypt, decrypt, upload, download, analyse +**Examples for actions**: activate, install, dev, develop, init, build, start, update, remove, delete, enable, disable, template, convert, create, edit, change, get, set, patch, fetch, generate, push, pull, import, export, list, publish, release, test, setup, prepare, restart, stop, store, restore, translate, upgrade, zip, visualize, sync, switch, run, reset, load, dump, checkout, commit, drop, deploy, handle, trigger, render, lint, uninstall, split, parse, fix, refactor, transform, cat, ls, rm, serve, help, show, filter, login, logout, encrypt, decrypt, upload, download, analyse, transpile, compile, minify, copy -**Examples for objects**: env, venv, submodule, container, database, snippet, model, module, repo, mail, doc, dependency, view, user, vault, file, host, node, log, password, hash, script, requirement, part, component, system, workspace, image, process, state, platform, dir, folder, readme, overview, lang, level, request, response, result, worker, server, proxy, workflow, volume, network, package, field, value, secret, chart, node, edge, function, method, firewall +**Examples for objects**: env, venv, submodule, container, database, snippet, model, module, repo, mail, doc, dependency, view, user, vault, file, host, node, log, password, hash, script, requirement, part, component, system, workspace, image, process, state, platform, dir, folder, readme, overview, lang, level, request, response, result, worker, server, proxy, workflow, volume, network, package, field, value, secret, chart, node, edge, function, method, firewall, html, css, style, query, native, group -**Objects can be tools**: odoo, vupress, node, zsh, bash, fish, podman, kind, minikube, helm, nvim, docker, podman, rust, python, tmux, vim, helix, system, git, pass, llm, sql, dotenv, javascript, vue, vite, astro, typescript, turbo, pnpm, eslint, jenkins, k8s, nextcloud, postgres, metabase, ansible, prometheus, grafana +**Objects can be tools**: odoo, vupress, nodejs, zsh, bash, fish, podman, kind, minikube, helm, nvim, docker, podman, rust, python, tmux, vim, helix, system, git, pass, llm, sql, dotenv, javascript, vue, vite, astro, typescript, turbo, pnpm, eslint, jenkins, k8s, nextcloud, postgres, metabase, ansible, prometheus, grafana, hugo, deno, bun, babel, panda, gulp, grunt, electron, react, express, mongo, angular, ionic, meteor, webpack, bower ## Patterns diff --git a/js/randomFunctionNames.js b/js/randomFunctionNames.js index 45ff686..d2fc858 100644 --- a/js/randomFunctionNames.js +++ b/js/randomFunctionNames.js @@ -1,4 +1,3 @@ - // Function to extract array from span content const getItemsFromSpan = (spanId) => { const span = document.getElementById(spanId); @@ -11,14 +10,13 @@ const getItemsFromSpan = (spanId) => { // Load actions and objects from spans let actions = []; let objects = []; +let objectTools = []; // Load after DOM is ready document.addEventListener('DOMContentLoaded', () => { actions = getItemsFromSpan('actions'); - objects = [ - ...getItemsFromSpan('objects'), - ...getItemsFromSpan('object-tools') - ]; + objects = getItemsFromSpan('objects'); + objectTools = getItemsFromSpan('object-tools'); }); // Function to get a random item from an array @@ -27,16 +25,17 @@ const getRandomItem = (arr) => arr[Math.floor(Math.random() * arr.length)]; // Function to generate random function names const generateFunctionName = () => { const action = getRandomItem(actions); - const object = getRandomItem(objects); + const firstObject = getRandomItem([...objects, ...objectTools]); // Randomly decide if a compound object name should be created const compound = Math.random() > 0.7; if (compound) { + // Only use regular objects as the second object const secondObject = getRandomItem(objects); - return `${action}-${object}-${secondObject}`; + return `${action}-${firstObject}-${secondObject}`; } - return `${action}-${object}`; + return `${action}-${firstObject}`; }; // Generate a list of random function names @@ -63,4 +62,4 @@ document.addEventListener('DOMContentLoaded', () => { if (button) { button.addEventListener('click', displayFunctionNames); } -}); \ No newline at end of file +});