{"id":17472594,"url":"https://github.com/shinnn/array-to-sentence","last_synced_at":"2025-04-09T22:53:41.689Z","repository":{"id":23387653,"uuid":"26749333","full_name":"shinnn/array-to-sentence","owner":"shinnn","description":"Join all elements of an array and create a human-readable string","archived":false,"fork":false,"pushed_at":"2019-03-17T23:12:52.000Z","size":43,"stargazers_count":33,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T22:53:34.373Z","etag":null,"topics":["array","concatenation","javascript","natural-language","sentence"],"latest_commit_sha":null,"homepage":"https://npm.runkit.com/array-to-sentence","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.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":"2014-11-17T09:22:07.000Z","updated_at":"2023-01-03T22:27:39.000Z","dependencies_parsed_at":"2022-08-23T01:31:02.679Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/array-to-sentence","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-to-sentence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-to-sentence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-to-sentence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-to-sentence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/array-to-sentence/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125632,"owners_count":21051766,"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":["array","concatenation","javascript","natural-language","sentence"],"created_at":"2024-10-18T17:28:28.179Z","updated_at":"2025-04-09T22:53:41.668Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# array-to-sentence\n\n[![npm version](https://img.shields.io/npm/v/array-to-sentence.svg)](https://www.npmjs.com/package/array-to-sentence)\n[![Build Status](https://travis-ci.com/shinnn/array-to-sentence.svg?branch=master)](https://travis-ci.com/shinnn/array-to-sentence)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/array-to-sentence.svg)](https://coveralls.io/github/shinnn/array-to-sentence)\n\nJoin all elements of an array and create a human-readable string\n\n```javascript\narrayToSentence(['foo', 'bar', 'baz', 'qux']); //=\u003e 'foo, bar, baz and qux'\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install array-to-sentence\n```\n\n## API\n\n```javascript\nimport arrayToSentence from 'array-to-sentence';\n```\n\n### arrayToSentence(*array* [, *options*])\n\n*array*: `Array\u003cany\u003e`  \n*options*: `Object`  \nReturn: `string`\n\nIt joins all elements of an array, and returns a string in the form `A, B, ... and X`.\n\n```javascript\narrayToSentence(['one', 'two', 3]); //=\u003e 'one, two and 3'\narrayToSentence(['one', 'two']); //=\u003e 'one and two'\narrayToSentence(['one']); //=\u003e 'one'\n\narrayToSentence([]); //=\u003e ''\n```\n\n### options.separator\n\nType: `string`  \nDefault: `', '`\n\nSet the separator string of each word.\n\n### options.lastSeparator\n\nType: `string`  \nDefault: `' and '`\n\nSet the separator string before the last word.\n\n```javascript\narrayToSentence(['A', 'B', 'C'], {\n  separator: '-',\n  lastSeparator: '-'\n}); //=\u003e 'A-B-C'\n\narrayToSentence(['Earth', 'Wind', 'Fire'], {\n  lastSeparator: ' \u0026 '\n}); //=\u003e 'Earth, Wind \u0026 Fire'\n```\n\n## License\n\n[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Farray-to-sentence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Farray-to-sentence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Farray-to-sentence/lists"}