{"id":20513811,"url":"https://github.com/webreflection/majinbuu","last_synced_at":"2025-03-05T23:14:49.416Z","repository":{"id":65993216,"uuid":"102461658","full_name":"WebReflection/majinbuu","owner":"WebReflection","description":"Morph an array into another via Levenshtein distance","archived":false,"fork":false,"pushed_at":"2017-11-29T19:35:09.000Z","size":171,"stargazers_count":30,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-04T03:55:04.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/WebReflection.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-05T09:24:58.000Z","updated_at":"2024-11-04T06:25:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"d611762d-809f-426c-8fd9-2ef3c12e501b","html_url":"https://github.com/WebReflection/majinbuu","commit_stats":{"total_commits":46,"total_committers":2,"mean_commits":23.0,"dds":"0.021739130434782594","last_synced_commit":"bae5c9c41cfbe0f37aa5499cba7b5e77f958b382"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmajinbuu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmajinbuu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmajinbuu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fmajinbuu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/majinbuu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242117718,"owners_count":20074438,"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":[],"created_at":"2024-11-15T21:13:21.093Z","updated_at":"2025-03-05T23:14:49.363Z","avatar_url":"https://github.com/WebReflection.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Majin Buu\n\n[![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) [![Build Status](https://travis-ci.org/WebReflection/majinbuu.svg?branch=master)](https://travis-ci.org/WebReflection/majinbuu) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/majinbuu/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/majinbuu?branch=master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026style=flat)](https://github.com/WebReflection/donate)\n\n\nApply the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to transform / morph an Array into another, performing the least amount of needed `.splice(...)` operations.\n\n```js\nconst abra = ['a', 'b', 'r', 'a'];\nmajinbuu(abra, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);\n\nabra; // now ['c', 'a', 'd', 'a', 'b', 'r', 'a']\n```\n\nIt is also possible to intercept all splice calls using an `aura`,\nwhich augments the `splice` method of the list,\ndelegating the interceptor one.\n```js\nconst abra = ['a', 'b', 'r', 'a'];\nconst interceptor = {\n  splice(index, removal, ...items) {\n    console.log(index, removal, ...items);\n    abra.splice.apply(abra, arguments);\n  }\n};\nconst aura = majinbuu.aura(interceptor, abra);\n\nmajinbuu(aura, ['c', 'a', 'd', 'a', 'b', 'r', 'a']);\n// 0 0 \"c\"\n// 2 0 \"d\" \"a\"\n```\n\nThe optional third argument avoid processing grids that are too big (comparing lists with too many items).\n```js\nconst noMoreThan1K = 1000;\nmajinbuu(list1, list2, noMoreThan1K);\n```\nIf the square of the `list1` and `list2` product is higher than `noMoreThan1K`,\nthe splice operation will remove all `list1` items and push all `list2`.\n\n### Compatibility\n\nEvery. JavaScript. Engine.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fmajinbuu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fmajinbuu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fmajinbuu/lists"}