{
  "_id": "once",
  "maintainers": [
    {
      "name": "isaacs",
      "email": "i@izs.me"
    }
  ],
  "keywords": [
    "once",
    "function",
    "one",
    "single"
  ],
  "dist-tags": {
    "latest": "1.4.0"
  },
  "author": {
    "url": "http://blog.izs.me/",
    "name": "Isaac Z. Schlueter",
    "email": "i@izs.me"
  },
  "_rev": "68-1d6bd1d6ca5d4af5aba0439604f4e2ce",
  "description": "Run a function exactly one time",
  "readme": "# once\n\nOnly call a function once.\n\n## usage\n\n```javascript\nvar once = require('once')\n\nfunction load (file, cb) {\n  cb = once(cb)\n  loader.load('file')\n  loader.once('load', cb)\n  loader.once('error', cb)\n}\n```\n\nOr add to the Function.prototype in a responsible way:\n\n```javascript\n// only has to be done once\nrequire('once').proto()\n\nfunction load (file, cb) {\n  cb = cb.once()\n  loader.load('file')\n  loader.once('load', cb)\n  loader.once('error', cb)\n}\n```\n\nIronically, the prototype feature makes this module twice as\ncomplicated as necessary.\n\nTo check whether you function has been called, use `fn.called`. Once the\nfunction is called for the first time the return value of the original\nfunction is saved in `fn.value` and subsequent calls will continue to\nreturn this value.\n\n```javascript\nvar once = require('once')\n\nfunction load (cb) {\n  cb = once(cb)\n  var stream = createStream()\n  stream.once('data', cb)\n  stream.once('end', function () {\n    if (!cb.called) cb(new Error('not found'))\n  })\n}\n```\n\n## `once.strict(func)`\n\nThrow an error if the function is called twice.\n\nSome functions are expected to be called only once. Using `once` for them would\npotentially hide logical errors.\n\nIn the example below, the `greet` function has to call the callback only once:\n\n```javascript\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) cb('Hello anonymous')\n  cb('Hello ' + name)\n}\n\nfunction log (msg) {\n  console.log(msg)\n}\n\n// this will print 'Hello anonymous' but the logical error will be missed\ngreet(null, once(msg))\n\n// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time\ngreet(null, once.strict(msg))\n```\n",
  "repository": {
    "url": "git://github.com/isaacs/once.git",
    "type": "git"
  },
  "users": {
    "yi": true,
    "abg": true,
    "ash": true,
    "detj": true,
    "fill": true,
    "isik": true,
    "shan": true,
    "vwal": true,
    "arefm": true,
    "sjnnr": true,
    "adamlu": true,
    "saru95": true,
    "stdarg": true,
    "barenko": true,
    "chengen": true,
    "nichoth": true,
    "coalesce": true,
    "donnicky": true,
    "dzhou777": true,
    "novaleaf": true,
    "codebyren": true,
    "edwingeng": true,
    "gochomugo": true,
    "karthickt": true,
    "milfromoz": true,
    "mojaray2k": true,
    "jpwilliams": true,
    "kingtrocki": true,
    "knksmith57": true,
    "morogasper": true,
    "quocnguyen": true,
    "rocket0191": true,
    "seangenabe": true,
    "amirmehmood": true,
    "ergunozyurt": true,
    "flumpus-dev": true,
    "garenyondem": true,
    "jamescostian": true,
    "loselovegirl": true,
    "mattmcfarland": true,
    "schnittstabil": true
  },
  "bugs": {
    "url": "https://github.com/isaacs/once/issues"
  },
  "license": "ISC",
  "versions": {
    "1.1.1": {
      "name": "once",
      "version": "1.1.1",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "BSD",
      "_id": "once@1.1.1",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "dist": {
        "shasum": "9db574933ccb08c3a7614d154032c09ea6f339e7",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.1.1.tgz",
        "integrity": "sha512-frdJr++QKEg4+JylTX+NNLgSoO6M2pDNYOOXe4WGIYKKBADBI9nU3oa06y4D4FpAJ3obAsjExeBOnscYJB9Blw==",
        "signatures": [
          {
            "sig": "MEUCIQCieyV970jTTntKimuhh/o7Az1lX0tdw5DuM56P5qFKUwIgXLJvOJdZVbbHBrPyEPESrpG4Goe/BNQ5+1B4SLk+pbk=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once",
        "type": "git"
      },
      "_npmVersion": "1.1.48",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "dependencies": {},
      "devDependencies": {
        "tap": "~0.3.0"
      }
    },
    "1.2.0": {
      "name": "once",
      "version": "1.2.0",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "BSD",
      "_id": "once@1.2.0",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "de1905c636af874a8fba862d9aabddd1f920461c",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.2.0.tgz",
        "integrity": "sha512-WBd9yDi3JRrEsysh0s4px+jinLuW/DGRydS+ZGPTHVKu4JrIBmKj3uDC9LfnwEbXHFVLieUuZvunY74wln6arg==",
        "signatures": [
          {
            "sig": "MEQCIGOBig6W3FyMp9sh0K4QLICwV9qESYWylncRMBchsK9YAiA2QpvinLj0PKj4dclj/TyLxNF0uGp4Z8gWiG8xDWgQNQ==",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once",
        "type": "git"
      },
      "_npmVersion": "1.3.7",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "dependencies": {},
      "devDependencies": {
        "tap": "~0.3.0"
      }
    },
    "1.3.0": {
      "name": "once",
      "version": "1.3.0",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "BSD",
      "_id": "once@1.3.0",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "151af86bfc1f08c4b9f07d06ab250ffcbeb56581",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.3.0.tgz",
        "integrity": "sha512-A31oqbdEQnnhkjIXJ6QKcgO9eN8Xe+dVAQqlFLAmri0Y5s11pUadCihT2popU2WLd5CbbnD2ZVkbEJsR/8JHvA==",
        "signatures": [
          {
            "sig": "MEYCIQD8RXfVUBPi+ZxXJoQ8mgRZBFokEux5o51yaiVmFl8NmgIhAIh5XtdYRWuYFWt8HGLWQuxA/zNZD+qewa7atQMU6F9o",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once",
        "type": "git"
      },
      "_npmVersion": "1.3.11",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "dependencies": {},
      "devDependencies": {
        "tap": "~0.3.0"
      }
    },
    "1.3.1": {
      "name": "once",
      "version": "1.3.1",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "BSD",
      "_id": "once@1.3.1",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/isaacs/once",
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "f3f3e4da5b7d27b5c732969ee3e67e729457b31f",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.3.1.tgz",
        "integrity": "sha512-NzfbaaoQvz2JC/D/Yj3GZi0FJG1w9i3K9Bp99Ws3p0xriPynC/YfRcpo2zoVuIduvH4b8+6up4ogGxnqajSKhA==",
        "signatures": [
          {
            "sig": "MEQCICjEN6vmHO9gyWeVXNZBqftltDNnhMMes7qlk1utWC9tAiAIA5xUJDAr9juUnlIDgNi8ynVRYjOBLFx8BMOjvra2mQ==",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "_shasum": "f3f3e4da5b7d27b5c732969ee3e67e729457b31f",
      "gitHead": "c90ac02a74f433ce47f6938869e68dd6196ffc2c",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once",
        "type": "git"
      },
      "_npmVersion": "2.0.0",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "_nodeVersion": "0.10.31",
      "dependencies": {
        "wrappy": "1"
      },
      "devDependencies": {
        "tap": "~0.3.0"
      }
    },
    "1.3.2": {
      "name": "once",
      "version": "1.3.2",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "ISC",
      "_id": "once@1.3.2",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/isaacs/once#readme",
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.3.2.tgz",
        "integrity": "sha512-tPQxpk4nBjTgu+eHijWhgX2d+tE6HQyMPVnzY5b1qenTUFsxBaKlzEFUF+XVfbToFuVFm8hX+PzV9u3PewDZ4Q==",
        "signatures": [
          {
            "sig": "MEQCIE7IuyMTX7DKRwCdMuhBqt7Y2ievtgM3ro3BtNeG8MH/AiA2VLezEPQWs3rkaSNsZ7Q6Llli+kcR4pOg+EcIKlvMhQ==",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b",
      "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "isaacs@npmjs.com"
      },
      "repository": {
        "url": "git://github.com/isaacs/once.git",
        "type": "git"
      },
      "_npmVersion": "2.9.1",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "_nodeVersion": "2.0.0",
      "dependencies": {
        "wrappy": "1"
      },
      "devDependencies": {
        "tap": "~0.3.0"
      }
    },
    "1.3.3": {
      "name": "once",
      "version": "1.3.3",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "ISC",
      "_id": "once@1.3.3",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/isaacs/once#readme",
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.3.3.tgz",
        "integrity": "sha512-6vaNInhu+CHxtONf3zw3vq4SP2DOQhjBvIa3rNcG0+P7eKWlYH6Peu7rHizSloRU2EwMz6GraLieis9Ac9+p1w==",
        "signatures": [
          {
            "sig": "MEUCIFtJMdkUTYhzUE/ucuz0mZ/hhlHxaRAquKjl6xtrpaLOAiEAjs078yGtzBdWWy8vRBGJZ0gtaY9xvIY3abBMujoXl4E=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "files": [
        "once.js"
      ],
      "_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20",
      "gitHead": "2ad558657e17fafd24803217ba854762842e4178",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once.git",
        "type": "git"
      },
      "_npmVersion": "3.3.2",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "_nodeVersion": "4.0.0",
      "dependencies": {
        "wrappy": "1"
      },
      "devDependencies": {
        "tap": "^1.2.0"
      }
    },
    "1.4.0": {
      "name": "once",
      "version": "1.4.0",
      "keywords": [
        "once",
        "function",
        "one",
        "single"
      ],
      "author": {
        "url": "http://blog.izs.me/",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "ISC",
      "_id": "once@1.4.0",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/isaacs/once#readme",
      "bugs": {
        "url": "https://github.com/isaacs/once/issues"
      },
      "dist": {
        "shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/once/-/once-1.4.0.tgz",
        "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
        "signatures": [
          {
            "sig": "MEQCIBoG/U/tJpr0WZlTEuYKTiY+IHcJ8q7ltkuQPJlL9q4ZAiB6nAD2IwFhsf3OOMThg/wNPiKveaMutTIScY9fya/n1g==",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ]
      },
      "main": "once.js",
      "_from": ".",
      "files": [
        "once.js"
      ],
      "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
      "gitHead": "0e614d9f5a7e6f0305c625f6b581f6d80b33b8a6",
      "scripts": {
        "test": "tap test/*.js"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git://github.com/isaacs/once.git",
        "type": "git"
      },
      "_npmVersion": "3.10.7",
      "description": "Run a function exactly one time",
      "directories": {
        "test": "test"
      },
      "_nodeVersion": "6.5.0",
      "dependencies": {
        "wrappy": "1"
      },
      "devDependencies": {
        "tap": "^7.0.1"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/once-1.4.0.tgz_1473196269128_0.537820661207661",
        "host": "packages-12-west.internal.npmjs.com"
      }
    }
  },
  "name": "once",
  "time": {
    "created": "2012-08-14T07:25:56.929Z",
    "modified": "2026-04-27T09:09:29.281Z",
    "1.1.1": "2012-08-14T07:25:58.262Z",
    "1.2.0": "2013-08-12T02:55:21.962Z",
    "1.3.0": "2013-10-24T06:27:26.638Z",
    "1.3.1": "2014-09-18T23:05:04.887Z",
    "1.3.2": "2015-05-04T23:09:54.026Z",
    "1.3.3": "2015-11-20T21:45:14.765Z",
    "1.4.0": "2016-09-06T21:11:09.367Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/isaacs/once#readme"
}