{"id":31565816,"url":"https://github.com/smart-table/smart-table-operators","last_synced_at":"2025-10-05T07:17:56.338Z","repository":{"id":16785082,"uuid":"80637504","full_name":"smart-table/smart-table-operators","owner":"smart-table","description":"functional operators for smart table and friends","archived":false,"fork":false,"pushed_at":"2022-12-07T17:43:07.000Z","size":202,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-18T19:24:35.947Z","etag":null,"topics":["browser","functional","grid","smart-table","table"],"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/smart-table.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-02-01T16:09:09.000Z","updated_at":"2023-08-19T11:25:25.000Z","dependencies_parsed_at":"2023-01-13T19:01:25.868Z","dependency_job_id":null,"html_url":"https://github.com/smart-table/smart-table-operators","commit_stats":null,"previous_names":["lorenzofox3/smart-table-operators"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/smart-table/smart-table-operators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smart-table%2Fsmart-table-operators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smart-table%2Fsmart-table-operators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smart-table%2Fsmart-table-operators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smart-table%2Fsmart-table-operators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smart-table","download_url":"https://codeload.github.com/smart-table/smart-table-operators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smart-table%2Fsmart-table-operators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278421863,"owners_count":25984081,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["browser","functional","grid","smart-table","table"],"created_at":"2025-10-05T07:17:54.945Z","updated_at":"2025-10-05T07:17:56.330Z","avatar_url":"https://github.com/smart-table.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smart-table-operators\n\n[![CircleCI](https://circleci.com/gh/smart-table/smart-table-operators.svg?style=svg)](https://circleci.com/gh/smart-table/smart-table-operators)\n\nA basic set of functional operators (or higher order function) for nodejs and browsers. Used internally in [smart-table]('https://github.com/smart-table/smart-table-core') but can be useful to anyone. However if you need something more elaborated you'll probably be more interested in\n[Ramda](https://github.com/ramda/ramda) or [lodash](https://github.com/lodash/lodash)\n\n## Installation\n\n### npm\n\n``npm install smart-table-operators --save``\n\n### yarn\n\n``yarn add smart-table-operators``\n\n## Usage\n\n### swap\n\nSwap arguments, returning a new function.\n\n```Javascript\nimport {swap} from 'smart-table-operators';\n\nconst substract = (a,b) =\u003e a-b;\nconst f = swap(substract);\nsubstract(4,2);\n// \u003e 2\nf(4,2);\n// \u003e -2\n```\n\n### compose\n\ncompose function returning a new function.\n\n```Javascript\nimport {compose} from 'smart-table-operators';\n\nconst addTwo = (a) =\u003e a + 2;\nconst multiplyByThree = (a) =\u003e a * 3;\n\nconst addTwoTimesThree = compose(addTow, multiplyByThree);\n\naddTwoTimesThree(4);\n// \u003e 18\n```\n\n### tap\n\ncall side effects, returning a new function (which returns the initial argument).\n\n```Javascript\nimport {tap} from 'smart-table-operators';\n\nconst log = tap((a)=\u003econsole.log(a));\nconst four = log(4);\n// \u003e 4\nconsole.log(four)\n// \u003e 4\n```\n\n### curry\n\nTakes a function and return a new function. If this new function is called whereas the argument length is not equal to the arity, returns a new function.\n\n```Javascript\nimport {curry} from 'smart-table-operators'\nconst curriedAdd = curry((a,b) =\u003e a + b);\n\ncurriedAdd(2,3);\n// \u003e 5\nconst addTwo = curriedAdd(2);\n\naddTow(3);\n// \u003e 5\n```\n\nYou can specify the expected arity (useful when passing default value)\n\n```Javascript\nimport {curry} from 'smart-table-operators';\n\nconst add = function (a, b=2){return a+b;};\nconst curriedAdd = curry(add,2);\n\nconst addThree = curriedAdd(3);\naddThree();\n// \u003e 5\n```\n\n## Contributing\n\n### test\n\n``npm test``\n\nor\n\n``yarn test``\n\n### issues\n\nOnly **bugs** coming with a **running example**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmart-table%2Fsmart-table-operators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmart-table%2Fsmart-table-operators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmart-table%2Fsmart-table-operators/lists"}