{"id":41953554,"url":"https://github.com/dumbmatter/realistic-structured-clone","last_synced_at":"2026-01-25T22:01:35.252Z","repository":{"id":31618383,"uuid":"35183433","full_name":"dumbmatter/realistic-structured-clone","owner":"dumbmatter","description":"A pure JS implementation of the structured clone algorithm (or at least something pretty close to that).","archived":false,"fork":false,"pushed_at":"2022-03-17T15:37:27.000Z","size":126,"stargazers_count":25,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-21T16:57:41.636Z","etag":null,"topics":["structured-clone"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dumbmatter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-06T21:18:34.000Z","updated_at":"2022-04-29T01:09:02.000Z","dependencies_parsed_at":"2022-08-28T04:00:42.051Z","dependency_job_id":null,"html_url":"https://github.com/dumbmatter/realistic-structured-clone","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/dumbmatter/realistic-structured-clone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbmatter%2Frealistic-structured-clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbmatter%2Frealistic-structured-clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbmatter%2Frealistic-structured-clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbmatter%2Frealistic-structured-clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dumbmatter","download_url":"https://codeload.github.com/dumbmatter/realistic-structured-clone/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbmatter%2Frealistic-structured-clone/sbom","scorecard":{"id":359553,"data":{"date":"2025-08-11","repo":{"name":"github.com/dumbmatter/realistic-structured-clone","commit":"9306690324fa70c344d0d899be44615f7de3245a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Code-Review","score":1,"reason":"Found 4/26 approved changesets -- score normalized to 1","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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/dumbmatter/realistic-structured-clone/tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/dumbmatter/realistic-structured-clone/tests.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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 8 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":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"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-18T10:27:18.689Z","repository_id":31618383,"created_at":"2025-08-18T10:27:18.689Z","updated_at":"2025-08-18T10:27:18.689Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28760642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T20:56:06.009Z","status":"ssl_error","status_checked_at":"2026-01-25T20:54:48.203Z","response_time":113,"last_error":"SSL_read: 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":["structured-clone"],"created_at":"2026-01-25T22:01:34.622Z","updated_at":"2026-01-25T22:01:35.247Z","avatar_url":"https://github.com/dumbmatter.png","language":"JavaScript","readme":"# Realistic Structured Clone ![Build Status](https://github.com/dumbmatter/realistic-structured-clone/actions/workflows/test.yml/badge.svg)\n\n**You might not need this anymore!** A native `structuredClone` function is available in many recent environments, such as Node v17 and Firefox v94. [Check if your target environment has `structuredClone` built in.](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) If it does, use that.\n\nThis is a pure JS implementation of the [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) (or at least something pretty close to that).\n\nWhy do you want this? Well, you probably don't. If your goal is to just clone a JS object, you're better off with [lodash's _.cloneDeep](https://lodash.com/docs#cloneDeep) or [the popular `clone` module on npm](https://www.npmjs.com/package/clone).\n\nLet's try again... why do you want this? If you are making an implementation of an API that explicitly uses the structured clone algorithm (such as [IndexedDB](https://github.com/dumbmatter/fakeIndexedDB)), then you want something that handles quirks and edge cases exactly like the structured clone algorithm. That's what `realistic-structured-clone` is for. It's not totally there (see below) but it's a decent start.\n\n## Use\n\n[Install through npm:](https://www.npmjs.com/package/realistic-structured-clone)\n\n    $ npm install realistic-structured-clone\n\nThen use it:\n\n    // First load the module\n    // (Use Browserify or something if you're targeting the web)\n    var structuredClone = require('realistic-structured-clone');\n\n    // Clone a variable (will throw a DataCloneError for invalid input)\n    var clonedX = structuredClone(x);\n\n## Alternatives\n\nIf you look around, you'll notice various modules calling themselves implementations of the structured clone algorithm, such as [the `structured-clone` package on npm](https://www.npmjs.com/package/structured-clone). But that package, like all the others I've seen, doesn't actually seem to be an attempt at implementing the structured clone algorithm. It's just some arbitrary type of clone. As I wrote above, this distinction only matters if you really care about the nuances of the structured clone algorithm, which you probably don't.\n\nIf you're working in the browser, you can do [something like this](https://twitter.com/TedMielczarek/status/591315580277391360) to do a real structured clone:\n\n    function clone(x) {\n        return new Promise(function (resolve, reject) {\n            window.addEventListener('message', function(e) {\n                resolve(e.data);\n            });\n            window.postMessage(x, \"*\");\n        });\n    }\n    var x = {a:[1,2,3], b:{c:1}};\n    clone(x).then(function(cloned) {\n        console.log(\"x: %s\", JSON.stringify(x));\n        console.log(\"cloned: %s\", JSON.stringify(cloned));\n        console.log(\"x == cloned %s\", x == cloned);\n        console.log(\"x === cloned %s\", x === cloned);\n    });\n\nHowever, that won't help you in Node.js. It's also asynchronous, which could be a problem. `realistic-structured-clone` is synchronous and works everywhere.\n\n## Current State\n\nAs of version 2.0, it should be pretty damn close to the spec! However it is now just a light wrapper around the [Typeson](https://github.com/dfahlander/typeson) structured-cloning-throwing preset.\n\n## License\n\nApache 2.0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumbmatter%2Frealistic-structured-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdumbmatter%2Frealistic-structured-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumbmatter%2Frealistic-structured-clone/lists"}