{"id":20056222,"url":"https://github.com/devgru/ffp","last_synced_at":"2025-07-18T07:05:39.295Z","repository":{"id":57234953,"uuid":"96864579","full_name":"devgru/ffp","owner":"devgru","description":"FFP algorithm implementation","archived":false,"fork":false,"pushed_at":"2022-08-15T09:46:32.000Z","size":123,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T19:22:52.388Z","etag":null,"topics":[],"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/devgru.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-07-11T07:33:47.000Z","updated_at":"2022-08-15T09:37:07.000Z","dependencies_parsed_at":"2022-08-23T15:50:13.783Z","dependency_job_id":null,"html_url":"https://github.com/devgru/ffp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devgru/ffp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgru%2Fffp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgru%2Fffp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgru%2Fffp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgru%2Fffp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devgru","download_url":"https://codeload.github.com/devgru/ffp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgru%2Fffp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265716306,"owners_count":23816354,"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":[],"created_at":"2024-11-13T12:52:35.373Z","updated_at":"2025-07-18T07:05:39.267Z","avatar_url":"https://github.com/devgru.png","language":"JavaScript","readme":"# Farthest feasible point algorithm implementation\n\nAlgorithm is used to filter timeseries points to speed up rendering by defining maximum error on ordinate axis\nand skipping all points that fit in resulting corridor.\n\n\u003cimg src=\"https://raw.githubusercontent.com/devgru/ffp/master/demo.png\" alt=\"FFP Demo\" width=\"800\"\u003e\n\nFFP algorithm is described in [this](http://masc.cs.gmu.edu/wiki/uploads/GuilinLiu/ffp.pdf) paper, authored by Guilin Xinyu and Zhe Cheng.\n\nThe library is distributed as ES module.\n\nCheck [spec/ffp.spec.js](spec/ffp.spec.js) to see usage example.\n\nBuilt in collaboration with [Erohina Elena](https://github.com/erohinaelena), original version of FFP implementation can be found [here](http://bl.ocks.org/erohinaelena/882e7cadc2fd687cf2b3).\n\n## Installation\n\n```sh\n$ yarn add ffp\n# or\n$ npm install --save ffp\n```\n\n## Usage\n\nFFP is instantiated and used like this:\n\n```js\nimport FFP from \"ffp\";\nconst ffp = FFP()\n  .maxDeltaY(0.5) // define maximum delta\n  .x(({ x }) =\u003e x) // define x accessor\n  .y(({ y }) =\u003e y) // define y accessor\n  .result(({ value }) =\u003e value); // consume filtered points\n\nconst array = [\n  { x: 0, y: 3 },\n  { x: 1, y: 4 },\n  { x: 2, y: 5 },\n  // ...\n  { x: 5, y: 0 },\n];\n\nffp(array);\n```\n\nFFP library exports a function.\n\n## FFP()\n\nCreates FFP utility.\n\n## ffp(array)\n\nFFP utility is a function, invoke it on array of elements to filter them out.\n\n## ffp.maxDeltaY([*delta*])\n\nIf _delta_ is specified, sets the maximum _delta_ to the specified number. If _delta_ is not specified, returns the current maximum _delta_ value, which defaults to 1.\n\nMaximum _delta_ determines maximum variation between resulting trend and point position on ordinate axis.\n\n## ffp.epsilon([*epsilon*])\n\nIf _epsilon_ is specified, sets the _epsilon_ to the specified number. If _epsilon_ is not specified, returns the current _epsilon_ value, which defaults to 1/2³².\n\n_epsilon_ determines the maximum margin of error.\n\n## ffp.x([*xAccessor*])\n\nIf _xAccessor_ is specified, sets the _x_ accessor to the specified function. If _xAccessor_ is not specified, returns the current _x_ accessor, which defaults to `(value, index) =\u003e index`.\n\n_x_ accessor is invoked for each point.\n\n## ffp.y([*yAccessor*])\n\nIf _yAccessor_ is specified, sets the _y_ accessor to the specified function. If _yAccessor_ is not specified, returns the current _y_ accessor, which defaults to `(value) =\u003e value`.\n\n_x_ accessor is invoked for each point.\n\n## ffp.result([*resultMapper*])\n\nIf _resultMapper_ is specified, sets the _result_ mapper to the specified function. If _resultMapper_ is not specified, returns the current _result_ mapper, which defaults to `({ value }) =\u003e value`.\n\n_result_ mapper is invoked for each point. By default, `ffp(array)` returns an array of objects with `value` and `index` keys. Define custom _result_ mapper to modify this behavior.\n\n## Development\n\n- Run tests: `yarn test`;\n\n## License\n\nMIT © [Dmitriy Semyushkin](https://devg.ru)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgru%2Fffp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgru%2Fffp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgru%2Fffp/lists"}