{"id":15653751,"url":"https://github.com/sloria/perspective-api-client","last_synced_at":"2026-02-28T10:03:35.800Z","repository":{"id":27148852,"uuid":"112686847","full_name":"sloria/perspective-api-client","owner":"sloria","description":"Node.js client for the Perspective API","archived":false,"fork":false,"pushed_at":"2022-12-30T03:55:38.000Z","size":545,"stargazers_count":31,"open_issues_count":22,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-04T08:48:38.454Z","etag":null,"topics":["javascript","nodejs","perspective","perspective-api"],"latest_commit_sha":null,"homepage":"https://www.perspectiveapi.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/sloria.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-12-01T02:45:59.000Z","updated_at":"2025-07-20T16:16:41.000Z","dependencies_parsed_at":"2023-01-14T06:05:55.376Z","dependency_job_id":null,"html_url":"https://github.com/sloria/perspective-api-client","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sloria/perspective-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2Fperspective-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2Fperspective-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2Fperspective-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2Fperspective-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloria","download_url":"https://codeload.github.com/sloria/perspective-api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloria%2Fperspective-api-client/sbom","scorecard":{"id":831993,"data":{"date":"2025-08-11","repo":{"name":"github.com/sloria/perspective-api-client","commit":"c56db6481b37e8eaceaf7bf8735006b2032de0cd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"48 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-qx4v-6gc5-f2vv","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-qxg5-2qff-p49r","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T17:59:16.598Z","repository_id":27148852,"created_at":"2025-08-23T17:59:16.598Z","updated_at":"2025-08-23T17:59:16.598Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29929601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T09:58:13.507Z","status":"ssl_error","status_checked_at":"2026-02-28T09:57:57.047Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["javascript","nodejs","perspective","perspective-api"],"created_at":"2024-10-03T12:46:54.064Z","updated_at":"2026-02-28T10:03:35.765Z","avatar_url":"https://github.com/sloria.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# perspective-api-client\n\n[![Current Version](https://img.shields.io/npm/v/perspective-api-client.svg)](https://www.npmjs.org/package/perspective-api-client)\n[![Build Status](https://travis-ci.org/sloria/perspective-api-client.svg?branch=master)](https://travis-ci.org/sloria/perspective-api-client)\n\nNode.js client library for the [Perspective API](https://www.perspectiveapi.com/).\n\n## Install\n\n```\n$ npm install perspective-api-client\n```\n\n## Usage\n\n```js\nconst Perspective = require('perspective-api-client');\nconst perspective = new Perspective({apiKey: process.env.PERSPECTIVE_API_KEY});\n\n(async () =\u003e {\n  const text = 'you empty-headed animal food trough wiper!';\n  const result = await perspective.analyze(text);\n  console.log(JSON.stringify(result, null, 2));\n})();\n// {\n//   \"attributeScores\": {\n//     \"TOXICITY\": {\n//       \"spanScores\": [\n//         {\n//           \"begin\": 0,\n//           \"end\": 42,\n//           \"score\": {\n//             \"value\": 0.77587414,\n//             \"type\": \"PROBABILITY\"\n//           }\n//         }\n//       ],\n//       \"summaryScore\": {\n//         \"value\": 0.77587414,\n//         \"type\": \"PROBABILITY\"\n//       }\n//     }\n//   },\n//   \"languages\": [\n//     \"en\"\n//   ]\n// }\n```\n\n### Specifying models\n\nThe TOXICITY model is used by default. To specify additional models,\n    pass `options.attributes`.\n\n```js\n(async () =\u003e {\n  const text = 'fools!';\n  const result = await perspective.analyze(text, {attributes: ['unsubstantial', 'spam']});\n  console.log(JSON.stringify(result, null, 2));\n})();\n// {\n//   \"attributeScores\": {\n//     \"UNSUBSTANTIAL\": {\n//       \"spanScores\": [\n//         {\n//           \"begin\": 0,\n//           \"end\": 6,\n//           \"score\": {\n//             \"value\": 0.9592708,\n//             \"type\": \"PROBABILITY\"\n//           }\n//         }\n//       ],\n//       \"summaryScore\": {\n//         \"value\": 0.9592708,\n//         \"type\": \"PROBABILITY\"\n//       }\n//     },\n//     \"SPAM\": {\n//       \"spanScores\": [\n//         {\n//           \"begin\": 0,\n//           \"end\": 6,\n//           \"score\": {\n//             \"value\": 0.008744183,\n//             \"type\": \"PROBABILITY\"\n//           }\n//         }\n//       ],\n//       \"summaryScore\": {\n//         \"value\": 0.008744183,\n//         \"type\": \"PROBABILITY\"\n//       }\n//     }\n//   },\n//   \"languages\": [\n//     \"en\"\n//   ]\n// }\n```\n\n### More options\n\nYou can also pass an [AnalyzeComment](https://github.com/conversationai/perspectiveapi/blob/master/api_reference.md#analyzecomment-request)\nobject for more control over the request.\n\n```js\n(async () =\u003e {\n  const text = 'you empty-headed animal food trough wiper!';\n  const result = await perspective.analyze({\n    comment: {text},\n    requestedAttributes: {TOXICITY: {scoreThreshold: 0.7}},\n  });\n  console.log(JSON.stringify(result, null, 2));\n})();\n// {\n//   \"attributeScores\": {\n//     \"TOXICITY\": {\n//       \"spanScores\": [\n//         {\n//           \"begin\": 0,\n//           \"end\": 42,\n//           \"score\": {\n//             \"value\": 0.77587414,\n//             \"type\": \"PROBABILITY\"\n//           }\n//         }\n//       ],\n//       \"summaryScore\": {\n//         \"value\": 0.77587414,\n//         \"type\": \"PROBABILITY\"\n//       }\n//     }\n//   },\n//   \"languages\": [\n//     \"en\"\n//   ]\n// }\n```\n\n## API\n\n### perspective = new Perspective()\n\n#### analyze(text, [options])\n\n#### text\n\nType: `String` or `Object`\n\nEither the text to analyze or an [AnalyzeComment](https://github.com/conversationai/perspectiveapi/blob/master/api_reference.md#analyzecomment-request) object.\nHTML tags will be stripped by default.\n\n##### options\n\n###### attributes\n\nType: `Array` or `Object`\n\nModel names to analyze. `TOXICITY` is analyzed by default. If passing an Array of names, the names may be lowercased.\nSee https://github.com/conversationai/perspectiveapi/blob/master/api_reference.md#models\nfor a list of valid models.\n\n###### doNotStore\n\nType: `Boolean`\nDefault: `true`\n\nIf `true`, prevent API from storing comment and context from this request.\n\n##### stripHTML\n\nType: `Boolean`\nDefault: `true`\n\nWhether to strip HTML tags from the text.\n\n##### truncate\n\nType: `Boolean`\nDefault: `false`\n\nIf `true`, truncate text to the first 20480 characters (max length\n    allowed by the Perspective API).\n\n## FAQ\n\n### How does this compare to @conversationai/perspectiveapi-js-client?\n\nSimilarities:\n\n- Exposes the AnalyzeComment endpoint of the Perspective API\n- Strips HTML tags by default\n\nDifferences:\n\n\n- Returns full responses (rather than only returning summary scores)\n- Exposes all [AnalyzeComment](https://github.com/conversationai/perspectiveapi/blob/master/api_reference.md#analyzecomment-request) options\n- Supports all Node.js LTS versions\n\n## License\n\nMIT © [Steven Loria](http://stevenloria.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloria%2Fperspective-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloria%2Fperspective-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloria%2Fperspective-api-client/lists"}