{"id":16805946,"url":"https://github.com/haltcase/stunsail","last_synced_at":"2025-07-22T04:31:54.908Z","repository":{"id":57373104,"uuid":"80505543","full_name":"haltcase/stunsail","owner":"haltcase","description":"Super opinionated collection of utility functions.","archived":false,"fork":false,"pushed_at":"2020-12-06T07:00:01.000Z","size":568,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T05:51:31.156Z","etag":null,"topics":["collection","functions","hacktoberfest","library","modular","tools","utility"],"latest_commit_sha":null,"homepage":"https://stunsail.netlify.com/","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/haltcase.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","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-01-31T09:08:13.000Z","updated_at":"2020-12-06T07:00:04.000Z","dependencies_parsed_at":"2022-08-30T00:40:21.859Z","dependency_job_id":null,"html_url":"https://github.com/haltcase/stunsail","commit_stats":null,"previous_names":["citycide/stunsail"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/haltcase/stunsail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haltcase%2Fstunsail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haltcase%2Fstunsail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haltcase%2Fstunsail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haltcase%2Fstunsail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haltcase","download_url":"https://codeload.github.com/haltcase/stunsail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haltcase%2Fstunsail/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266427835,"owners_count":23926885,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["collection","functions","hacktoberfest","library","modular","tools","utility"],"created_at":"2024-10-13T09:49:42.149Z","updated_at":"2025-07-22T04:31:54.545Z","avatar_url":"https://github.com/haltcase.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stunsail \u0026middot; [![Version](https://flat.badgen.net/npm/v/stunsail)](https://www.npmjs.com/package/stunsail) [![License](https://flat.badgen.net/npm/license/stunsail)](https://www.npmjs.com/package/stunsail) [![Travis CI](https://flat.badgen.net/travis/citycide/stunsail)](https://travis-ci.org/citycide/stunsail) [![JavaScript Standard Style](https://flat.badgen.net/badge/code%20style/standard/green)](https://standardjs.com)\n\n\u003e Super opinionated, functional utility collection.\n\n## installation\n\n```sh\n# using yarn:\nyarn add stunsail\n\n# or npm:\nnpm i stunsail\n```\n\n## usage\n\n```js\nimport S from 'stunsail'\n\n// commonjs / ES5\nconst S = require('stunsail')\n```\n\nA module version is also available if you use ES modules:\n\n```js\nimport S from 'stunsail/es'\n```\n\nYou can also selectively `import` just what you need, which is especially\nrecommended if you use the [babel plugin](#babel-plugin) as this is much\nmore efficient.\n\n```js\nimport { defaults, kebabCase, matches, toArray } from 'stunsail'\n\nconst { defaults, kebabCase, matches, toArray } = require('stunsail')\n```\n\n## api\n\nSee the [documentation here](https://stunsail.netlify.com/docs/api)\nfor a more complete reference.\n\n### overview\n\n```js\nimport {\n  clamp,\n  map,\n  filter,\n  first,\n  matches,\n  pipe,\n  toNumber\n} from 'stunsail'\n\nconst number = pipe(\n  '36',\n  num =\u003e toNumber(num),      // -\u003e 36\n  num =\u003e clamp(num, 10, 30), // -\u003e 30\n  num =\u003e console.log(num)    // -\u003e 'number = 30'\n)\n\nconst found = pipe(\n  map([1, 2, 3, 4, 5], num =\u003e ({ value: num * 2 })),\n  // -\u003e [{ value: 2 }, { value: 4 }, ... ]\n  objects =\u003e filter(objects, obj =\u003e matches(obj, { value: 6 })),\n  // -\u003e [{ value: 6 }]\n  objects =\u003e first(objects),\n  // -\u003e { value: 6 }\n  obj =\u003e console.log(obj.value)\n  // -\u003e 6\n)\n```\n\n### with `param.macro`\n\nstunsail is really fun to use alongside [`param.macro`][macro] \u0026mdash; a Babel\nplugin that lets you partially apply functions at compile time. You can make\nthe [above example](#overview) look like this:\n\n```js\nimport { _, it } from 'param.macro'\nimport {\n  clamp,\n  map,\n  filter,\n  first,\n  matches,\n  pipe,\n  toNumber\n} from 'stunsail'\n\nconst number = pipe(\n  '36',\n  toNumber(_),\n  clamp(_, 10, 30),\n  console.log(`number = ${_}`)\n)\n\nconst found = pipe(\n  map([1, 2, 3, 4, 5], { value: it * 2 }),\n  filter(_, matches(_, { value: 6 })),\n  first(_),\n  console.log(_.value)\n)\n```\n\nThis combo allows you to use stunsail like you would lodash/fp or Ramda,\nbut without the runtime performance hit that comes with an auto-curried\nlibrary.\n\n## babel plugin\n\nstunsail ships with a babel plugin included. It can be used like so:\n\n### babel v7\n\n`.babelrc.js` \u0026rarr;\n\n```js\nmodule.exports = {\n  presets: [],\n  plugins: ['module:stunsail/babel']\n}\n```\n\n### babel v6\n\n`.babelrc` \u0026rarr;\n\n```json\n{\n  \"presets\": [],\n  \"plugins\": [\"stunsail/babel\"]\n}\n```\n\nThis will allow you to write simpler `import`s but output\nand still benefit from more efficient alternatives, ie:\n\n```js\nimport { partition } from 'stunsail'\n\n// commonjs / ES5\nconst { partition } = require('stunsail')\n```\n\n... will be compiled to:\n\n```js\nimport partition from 'stunsail/partition'\n\n// commonjs / ES5\nconst partition = require('stunsail/partition')\n```\n\n`import` statements can optionally be compiled to equivalent `require`\ncalls to avoid adding a module transformer separately.\n\n### configuration\n\nOptionally configure the plugin by using an Array of\n`[pluginName, optionsObject]`:\n\n```js\nmodule.exports = {\n  presets: [],\n  plugins: [\n    ['module:stunsail/babel', {\n      useRequire: false,\n      useModules: true\n    }]\n  ]\n}\n```\n\n| property     | type      | default | description |\n| :----------: | :-------: | :-----: | ----------- |\n| `useRequire` | `Boolean` | `false` | Whether to convert `import` statements to `require`s. Has no effect on `require` calls. |\n| `useModules` | `Boolean` | `false` | Redirect `stunsail` imports to `stunsail/es`. Ignored if `useRequire` is set to `true`. |\n\n## see also\n\n* [`param.macro`][macro] \u0026ndash; Babel plugin for compile-time partial application\n  and lambda parameters\n* [`tryad`][tryad] \u0026ndash; Monadic mashup of Maybe \u0026 Either (Option/Result) for\n  more functional null \u0026 error handling\n\n## contributing\n\nSearch the [issues](https://github.com/citycide/stunsail) if you come\nacross any trouble, open a new one if it hasn't been posted, or, if you're\nable, open a [pull request](https://help.github.com/articles/about-pull-requests/).\nContributions of any kind are welcome in this project.\n\n## license\n\nMIT © [Bo Lingen / citycide](https://github.com/citycide)\n\n[macro]: https://github.com/citycide/param.macro\n[tryad]: https://github.com/citycide/tryad\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaltcase%2Fstunsail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaltcase%2Fstunsail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaltcase%2Fstunsail/lists"}