{"id":15822635,"url":"https://github.com/sambacha/uno","last_synced_at":"2026-04-30T10:35:58.675Z","repository":{"id":54960170,"uuid":"299227353","full_name":"sambacha/uno","owner":"sambacha","description":"fetch a function as little as 'uno'","archived":false,"fork":false,"pushed_at":"2021-01-19T16:01:32.000Z","size":45,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T23:44:49.399Z","etag":null,"topics":["async","function","npm"],"latest_commit_sha":null,"homepage":"","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/sambacha.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":"2020-09-28T07:36:40.000Z","updated_at":"2022-09-28T07:58:21.000Z","dependencies_parsed_at":"2022-08-14T07:30:41.697Z","dependency_job_id":null,"html_url":"https://github.com/sambacha/uno","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Funo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Funo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Funo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Funo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambacha","download_url":"https://codeload.github.com/sambacha/uno/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598198,"owners_count":20802975,"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":["async","function","npm"],"created_at":"2024-10-05T08:01:24.555Z","updated_at":"2026-04-30T10:35:58.625Z","avatar_url":"https://github.com/sambacha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UNO \n\n`unomeharder` or `call a func approx. 1.00000000000 times`\n\n```js \n\"use strict\";\nusage;\nvar uno = require('uno');\nfunction load(file, cb) {\n    cb = uno(cb);\n    loader.load('file');\n    loader.uno('load', cb);\n    loader.uno('error', cb);\n}\n```\n\n\u003e  add to the Function.prototype\n\n```js\n\"use strict\";\n// only has to be done uno\nrequire('uno').proto();\nfunction load(file, cb) {\n    cb = cb.uno();\n    loader.load('file');\n    loader.uno('load', cb);\n    loader.uno('error', cb);\n}\n ```\n\n\u003e check whether your function has been called, use `fn.called.` uno the function is called for the first time the return value of the original function is saved in fn.value and subsequent calls will continue to return this value.\n\n```js\n\"use strict\";\nvar uno = require('uno');\nfunction load(cb) {\n    cb = uno(cb);\n    var stream = createStream();\n    stream.uno('data', cb);\n    stream.uno('end', function () {\n        if (!cb.called)\n            cb(new Error('not found'));\n    });\n}\n```\n\n`uno.strict(func)`\nThrow an error if the function is called twice.\n\nSome functions are expected to be called only uno. Using uno for them would potentially hide logical errors.\n\nIn the example below, the greet function has to call the callback only uno:\n\n```js\n\"use strict\";\nfunction greet(name, cb) {\n    // return is missing from the if statement\n    // when no name is passed, the callback is called twice\n    if (!name)\n        cb('Hello anonymous');\n    cb('Hello ' + name);\n}\nfunction log(msg) {\n    console.log(msg);\n}\n// this will print 'Hello anonymous' but the logical error will be missed\ngreet(null, uno(msg));\n// uno.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time\ngreet(null, uno.strict(msg));\n```\n\n## License \n\nMIT / ISC \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Funo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambacha%2Funo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Funo/lists"}