{"id":19560625,"url":"https://github.com/zoubin/xbind","last_synced_at":"2026-05-13T22:32:18.161Z","repository":{"id":32632207,"uuid":"36218305","full_name":"zoubin/xbind","owner":"zoubin","description":"Sugar way to adapt the arguments signature of functions.","archived":false,"fork":false,"pushed_at":"2015-07-05T03:49:49.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T01:25:27.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/zoubin.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-25T08:04:02.000Z","updated_at":"2015-06-20T08:31:44.000Z","dependencies_parsed_at":"2022-09-19T01:11:25.194Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/xbind","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/zoubin/xbind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fxbind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fxbind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fxbind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fxbind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/xbind/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fxbind/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33002654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"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":[],"created_at":"2024-11-11T05:08:18.600Z","updated_at":"2026-05-13T22:32:18.130Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xbind\n\nSugar way to adapt the arguments signature of functions.\n\n## Usage\n\n```javascript\nvar xbind = require('xbind');\n\nfunction arrayify() {\n    var ret = [];\n    for (var i = 0, len = arguments.length; i \u003c len; i++) {\n        ret.push(arguments[i]);\n    }\n    return ret;\n}\n\nconsole.log(\n    '`arrayify` just make an array from arguments',\n    arrayify(0,1,2,3)\n)\n// `arrayify` just make an array from arguments [ 0, 1, 2, 3  ]\n\nconsole.log(\n    'use the first argument',\n    xbind(arrayify).xargs(0)(0,1,2,3)\n)\n// use the first argument [ 0  ]\n\nconsole.log(\n    'use the first argument',\n    xbind(arrayify).first()(0,1,2,3)\n)\n// use the first argument [ 0  ]\n\nconsole.log(\n    'use the last argument',\n    xbind(arrayify).last()(0,1,2,3)\n)\n// use the last argument [ 3  ]\n\nconsole.log(\n    'use the first and third arguments',\n    xbind(arrayify).xargs(0,2)(0,1,2,3),\n    xbind(arrayify).xargs([0,2])(0,1,2,3)\n)\n// use the first and third arguments [ 0, 2  ] [ 0, 2  ]\n\nconsole.log(\n    'append arguments 4,5',\n    xbind(arrayify).push(4,5)(0,1,2,3)\n)\n// append arguments 4,5 [ 0, 1, 2, 3, 4, 5  ]\n\nconsole.log(\n    'prepend arguments 4,5',\n    xbind(arrayify).unshift(4,5)(0,1,2,3)\n)\n// prepend arguments 4,5 [ 4, 5, 0, 1, 2, 3  ]\n\nconsole.log(\n    'slice arguments 1,3',\n    xbind(arrayify).slice(1,3)(0,1,2,3)\n)\n// slice arguments 1,3 [ 1, 2  ]\n\nconsole.log(\n    'filter arguments',\n    xbind(arrayify).xargs(1,5).filter(Boolean)(0,1,2,3)\n)\n// filter arguments [ 1  ]\n\n```\n\n## xfn = xbind(fn, ctx)\n\nReturn a new function with a `xargs` property, through which arguments can be changed.\n\n### fn\n\nType: `Function`, `String`\n\nFunction to be bound. If `String`, it will be treated as a method name of `ctx`\n\n### ctx\n\nType: `Object`\n`Optional`\n\n`this` value of `fn` when called.\nIf not specified, `this` will be `this` of `xfn`.\n\n## operations\n\n### xfn.xargs(index1, index2)\n\nSelect arguments with `index1, index2`\n\n### xfn.first()\n\nSelect the first argument\n\n### xfn.last()\n\nSelect the last argument\n\n### Array methods\n\nYou can operate the argument list using `.push`, `.pop`, `.shift`, `.unshift`, `.slice`, `.splice`, `.filter`, `.map`, `.reduce`, as the argument list is `Array`.\n\n\n## xbind.identity(o)\n\nJust return a function that returns `o`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fxbind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Fxbind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fxbind/lists"}