{"id":47340055,"url":"https://github.com/emctague/veca","last_synced_at":"2026-03-17T22:44:18.561Z","repository":{"id":57391286,"uuid":"94889762","full_name":"emctague/veca","owner":"emctague","description":"A simple 2D and 3D vector library for JS.","archived":false,"fork":false,"pushed_at":"2017-10-29T23:23:50.000Z","size":4,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-25T22:51:52.491Z","etag":null,"topics":["javascript","math","nodejs","vectors"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emctague.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-20T12:40:22.000Z","updated_at":"2017-07-14T14:30:17.000Z","dependencies_parsed_at":"2022-08-25T18:41:44.248Z","dependency_job_id":null,"html_url":"https://github.com/emctague/veca","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emctague/veca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emctague%2Fveca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emctague%2Fveca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emctague%2Fveca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emctague%2Fveca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emctague","download_url":"https://codeload.github.com/emctague/veca/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emctague%2Fveca/sbom","scorecard":{"id":375060,"data":{"date":"2025-08-11","repo":{"name":"github.com/emctague/veca","commit":"07ee3b9f17a2d83a739cdeea5c530f425a4cff00"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T14:02:20.191Z","repository_id":57391286,"created_at":"2025-08-18T14:02:20.191Z","updated_at":"2025-08-18T14:02:20.191Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30633833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T22:38:22.569Z","status":"ssl_error","status_checked_at":"2026-03-17T22:38:11.804Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","math","nodejs","vectors"],"created_at":"2026-03-17T22:44:18.043Z","updated_at":"2026-03-17T22:44:18.556Z","avatar_url":"https://github.com/emctague.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# veca\n\nVeca is a simple library implementing 2-D and 3-D vectors.\n\n## Installation\n\n### From NodeJS\n\nFirst, use `npm install` to get `veca`.\nSecond, require veca like so:\n\n```js\nconst v = require('veca')\n```\n\nYou may now use veca's `v()` function.\n\n### From the Browser\n\nSimply download the file `v.js` from this repository, and then include it using:\n\n```html\n\u003cscript src='v.js'\u003e\u003c/script\u003e\n```\n\nYou can also use RawGit's CDN:\n\n```html\n\u003cscript src=\"https://cdn.rawgit.com/emctague/veca/2cae9b9a/v.js\"\u003e\u003c/script\u003e\n```\n\nOr UNPKG:\n\n```html\n\u003cscript src=\"https://unpkg.com/veca/v.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### Creating a Vector\n\nYou can create both 2-Dimensional and 3-Dimensional vectors using the `v`\nfunction.\n\n```js\nv(10, 20)\n// =\u003e x: 10, y: 20\n\nv(30, 40, 50)\n// =\u003e x: 30, y: 40, z: 50\n```\n\n### Converting a Vector to a String\n\nThe `str` method can be used to convert a vector to a simple, readable string:\n\n```js\nv(30, 20, 49).str()\n// =\u003e \"x: 30, y: 20, z: 49\"\n```\n\nThe vector will also be implicitly converted to a string:\n\n```js\n'The vector is:' + v(5, 15)\n// =\u003e \"The vector is: x: 5, y: 15\"\n```\n\n### Using the Values from a Vector\n\nYou can use the `x`, `y`, and `z` properties to interact directly with a\nvector's values.\n\n```js\nconst vector = v(5, 3, 9)\n\nvector.x\n// =\u003e 5\n\nvector.y\n// =\u003e 3\n\nvector.z\n// =\u003e 9\n\nvector.z = 10\nvector.str()\n// =\u003e \"x: 5, y: 3, z: 10\"\n```\n\n### Getting the Number of Dimensions in a Vector\n\nThe `dimens` method will return `2` or `3`, depending on whether or not\nthe vector is 3-Dimensional.\n\n```js\nv(3, 6).dimens()\n// =\u003e 2\n\nv(3, 6, 9).dimens()\n// =\u003e 3\n```\n\n### Converting a Vector to an Array or Object\n\nThe `arr` method converts the vector to an array.\n\n```js\nv(93, 2).arr()\n// =\u003e [ 93, 2 ]\n```\n\nSimilarly, the `obj` method will convert the vector to a simple object.\n\n```js\nv(20, 39, 42).obj()\n// =\u003e { x: 20, y: 39, z: 42 }\n```\n\n### Basic Mathematical Operations\n\nA number of basic operations can be used on a vector to manipulate its\nvalues. Each of these methods can be called with either another vector,\nin which case each value will be modified using the equivalent value in the\nother vector, or with a single number, which will be used to modify each\nof the vector values.\n\nDivision is done with the `div` method:\n\n```js\nv(2, 4, 6).div(2)\n// =\u003e x: 1, y: 2, z: 3\n\nv(2, 4, 6).div(v(2, 4, 3))\n// =\u003e x: 1, y: 1, z: 2\n```\n\nMultiplication is done with the `mult` method:\n\n```js\nv(2, 4, 6).mult(2)\n// =\u003e x: 4, y: 8, z: 12\n\nv(2, 4, 6).mult(v(2, 4, 3))\n// =\u003e x: 4, y: 16, z: 18\n```\n\nAddition is done with the `add` method:\n\n```js\nv(2, 4, 6).add(2)\n// =\u003e x: 4, y: 6, z: 8\n\nv(2, 4, 6).add(v(2, 4, 3))\n// =\u003e x: 4, y: 8, z: 9\n```\n\nSubtraction is done with the `sub` method:\n\n```js\nv(2, 4, 6).sub(2)\n// =\u003e x: 0, y: 2, z: 4\n\nv(2, 4, 6).div(v(2, 4, 3))\n// =\u003e x: 0, y: 0, z: 3\n```\n\nPowers are done with the `pow` method:\n\n```js\nv(2, 4, 6).pow(2)\n// =\u003e x: 4, y: 16, z: 36\n\nv(2, 4, 6).div(v(2, 4, 3))\n// =\u003e x: 4, y: 256, z: 216\n```\n\nModulo is done with the `mod` method:\n\n```js\nv(2, 4, 6).mod(3)\n// =\u003e x: 2, y: 1, z: 0\n\nv(2, 4, 6).mod(v(2, 4, 3))\n// =\u003e x: 0, y: 0, z: 0\n```\n\n### Dot Product\n\nThe dot product can be gotten using the `dot` method.\n\n```js\nv(5, 10, 15).dot(v(3, 6, 9))\n// =\u003e 210\n```\n\n### Cross Product\n\nThe cross product can be gotten using the `cross` method.\nThis only applies to 3-dimensional vectors.\n\n```js\nv(5, 10, 15).cross(v(12, 2, 3))\n// =\u003e x: 0, y: 165, z: -110\n```\n\n### Custom Iterative Methods\n\nCustom iterative methods, which behave in the same way as the \"Basic\nMathematical Operations\" specified above, can be created using the `iter`\nmethod:\n\n```js\nconst modify = v(3, 6).iter((a, b) =\u003e a**(b/2))\n\nmodify(4)\n// =\u003e x: 9, y: 36\n\nmodify(v(4, 6))\n// =\u003e x: 9, y: 216\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femctague%2Fveca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femctague%2Fveca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femctague%2Fveca/lists"}