{"id":16375306,"url":"https://github.com/borysshulyak/strapi-plugin-field-formula","last_synced_at":"2025-03-23T03:32:44.264Z","repository":{"id":187192389,"uuid":"672948372","full_name":"BorysShulyak/strapi-plugin-field-formula","owner":"BorysShulyak","description":"A plugin for Strapi Headless CMS that provides an integration with powerful mathjs library.","archived":false,"fork":false,"pushed_at":"2024-02-19T13:32:43.000Z","size":840,"stargazers_count":7,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T01:13:32.475Z","etag":null,"topics":["custom-fields","customization","formula","math","mathjs","plugin","strapi","strapi-custom-field","strapi-plugin"],"latest_commit_sha":null,"homepage":"","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/BorysShulyak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-31T14:22:34.000Z","updated_at":"2024-05-28T10:45:27.000Z","dependencies_parsed_at":"2024-10-28T15:51:10.979Z","dependency_job_id":null,"html_url":"https://github.com/BorysShulyak/strapi-plugin-field-formula","commit_stats":null,"previous_names":["borysshulyak/strapi-plugin-field-formula"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorysShulyak%2Fstrapi-plugin-field-formula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorysShulyak%2Fstrapi-plugin-field-formula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorysShulyak%2Fstrapi-plugin-field-formula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorysShulyak%2Fstrapi-plugin-field-formula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BorysShulyak","download_url":"https://codeload.github.com/BorysShulyak/strapi-plugin-field-formula/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267405,"owners_count":20425836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["custom-fields","customization","formula","math","mathjs","plugin","strapi","strapi-custom-field","strapi-plugin"],"created_at":"2024-10-11T03:20:16.654Z","updated_at":"2025-03-23T03:32:43.450Z","avatar_url":"https://github.com/BorysShulyak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" width=\"150px\"\u003e\n  \u003cimg style=\"width: 150px; height: auto;\" src=\"public/logo.png\" alt=\"Logo - Strapi Formula field\" /\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eStrapi v4 - Formula field\u003c/h1\u003e\n  \u003cp\u003ePowerful math operations just inside your Headless CMS!\u003c/p\u003e\n  \u003ca href=\"https://github.com/BorysShulyak/strapi-plugin-field-formula/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/BorysShulyak/strapi-plugin-field-formula\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/BorysShulyak/strapi-plugin-field-formula/issues\"\u003e\n    \u003cimg alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/BorysShulyak/strapi-plugin-field-formula?color=5d2de0\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/strapi-plugin-field-formula\"\u003e\n    \u003cimg alt=\"npm downloads\" src=\"https://img.shields.io/npm/dt/strapi-plugin-field-formula\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv style=\"margin: 20px 0\" align=\"center\"\u003e\n  \u003cimg style=\"width: 100%; height: auto;\" src=\"public/preview.png\" alt=\"UI preview\" /\u003e\n\u003c/div\u003e\n\nA plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides an integration with powerful\n[mathjs](https://mathjs.org/) library.\n\n## Table of Contents\n\n- [✨ Features](#-features)\n- [🧰 Requirements](#-requirements)\n- [🦾 Installation](#-installation)\n- [⚙️ Configuration](#-configuration)\n- [♾️Usage](#-usage)\n- [🛠️ Contributing](#-contributing)\n- [🗺️ Roadmap](#-roadmap)\n- [❤️Support or Donate](#-support-or-donate)\n- [💕Special Thanks](#-special-thanks)\n\n## ✨ Features\n\n- [Strapi Custom Field](https://docs.strapi.io/dev-docs/custom-fields) for calculating the provided formula.\n- [mathjs](https://mathjs.org/) integration.\n  - Supports numbers, big numbers, complex numbers, fractions, units, strings, arrays, and matrices.\n  - Is compatible with JavaScript’s built-in Math library.\n  - Contains a flexible expression parser.\n  - Does symbolic computation.\n  - Comes with a large set of built-in functions and constants.\n- Calculating the `formula` with the provided `scope` using the powerful `mathjs.evaluate` method. [Read More.](https://mathjs.org/docs/expressions/parsing.html#evaluate)\n\n## 🧰 Requirements\n\n- `strapi@4.X.X`\n\nComplete installation requirements are exact the same as for Strapi itself and could be found in the [official Strapi\ndocumentation](https://docs.strapi.io/dev-docs/quick-start).\n\n\u003e Before installing Strapi, the following requirements must be installed on your computer:\n\u003e\n\u003e - Node.js: Only Maintenance and LTS versions are supported (v18, and v20).\n\u003e   - Node v18.x is recommended for Strapi v4.3.9 and above\n\u003e - Your preferred Node.js package manager:\n\u003e   - npm (v6 and above)\n\u003e   - yarn\n\n## 🦾 Installation\n\n```shell\nyarn add strapi-plugin-field-formula@latest\n```\n\n**OR**\n\n```shell\nnpm install strapi-plugin-field-formula@latest\n```\n\nAfter successful installation you could re-build the Strapi instance. You could use the next commands (default) inside\nyour Strapi project:\n\n```shell\nyarn build\nyarn develop\n```\n\n## ⚙️ Configuration\n\nAs a next step you must configure the plugin following the [official Strapi documentation](https://docs.strapi.io/dev-docs/plugins/documentation#configuration).\n\nWe need to enable the plugin by adding it to the Strapi plugin config file located in `./config/plugins.js` of your Strapi\nproject. If this file does not exist yer, you have to create it manually.\n\nCopy and paste the following config into you `./config/plugins.js` file:\n\n```javascript\n// ./config/plugins.js`\nmodule.exports = {\n  // ...\n  \"field-formula\": {\n    enabled: true,\n  },\n  //...\n};\n```\n\nMy congratulation 😄! You have successfully installed and configured the **Strapi Plugin Field Formula**.\n\n## ♾️ Usage\n\n\u003e Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support\n\u003e for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated\n\u003e solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.\n\u003e Powerful and easy to use.\n\nHere is some examples, but to use this plugin on the full 100%, you have to read the official [Mathjs](https://mathjs.org/examples/index.html)\ndocumentation, and especially the [expressions](https://mathjs.org/examples/expressions.js.html) part as `formula` is\nthe same thing as `mathjs.evaluate` method 🤫\n\n\u003e Function `evaluate` accepts a single **(in our case)** `expression` or an array with expressions as the first argument\n\u003e and has an optional second argument containing a `scope` with variables and functions. The scope can be a regular\n\u003e JavaScript Object, or Map **(JSON in our case)**. The scope will be used to resolve symbols, and to write assigned\n\u003e variables or function.\n\n### Example 1\n\n```\nformula: sqrt(x^y + r^k)\nscope: {\n  \"x\": 2,\n  \"y\": 3,\n  \"r\": 4,\n  \"k\": 5\n}\nresult: 32.12475680841802\n```\n\n### Example 2\n\n```\nformula: cos(x deg)\nscope: { \"x\": 45 }\nresult: 0.7071067811865476\n```\n\n## 🛠️ Contributing\n\nSee the [CONTRIBUTING.md](https://github.com/BorysShulyak/strapi-plugin-field-formula/blob/main/CONTRIBUTING.md)\ndocument.\n\n## 🗺️ Roadmap\n\n- Object response to unleash more difficult expressions.\n\n## ❤️ Support or Donate\n\nIf you are enjoying this plugin and feel extra appreciative, you could [buy me a book](https://bmc.link/borisshulyak)\n📖 or 3 📖📖📖.\n\n## 💕 Special Thanks\n\n- I want to say thank you to **my wife Diana** for her love, daily support, motivation and inspiration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborysshulyak%2Fstrapi-plugin-field-formula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborysshulyak%2Fstrapi-plugin-field-formula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborysshulyak%2Fstrapi-plugin-field-formula/lists"}