Sign In

@socketregistry/stop-iteration-iterator

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socketregistry/stop-iteration-iterator - npm Package Compare versions

Comparing version
0.0.0
to
1.0.0
+4
index.d.ts
declare function getStopIterationIterator<T>(
origIterator: Iterator<T>,
): Iterator<T>
export = getStopIterationIterator
'use strict'
const stopIteration =
typeof globalThis.StopIteration === 'object' ? globalThis.StopIteration : null
const doneState = new WeakMap()
module.exports = function getStopIterationIterator(origIterator) {
if (!stopIteration) {
throw new SyntaxError('this environment lacks StopIteration')
}
doneState.set(origIterator, false)
return {
next() {
const done = !!doneState.get(origIterator)
try {
return {
done,
value: done ? undefined : origIterator.next(),
}
} catch (e) {
doneState.set(origIterator, true)
if (e !== stopIteration) {
throw e
}
return { done: true, value: undefined }
}
},
}
}
MIT License
Copyright (c) 2024 Socket Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Sorry, the diff of this file is not supported yet

+36
-5
{
"name": "@socketregistry/stop-iteration-iterator",
"version": "0.0.0",
"private": false,
"version": "1.0.0",
"description": "Socket.dev optimized package override for stop-iteration-iterator",
"keywords": [
"Socket.dev",
"package-overrides"
],
"homepage": "https://github.com/SocketDev/socket-registry/tree/main/packages/npm/stop-iteration-iterator",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/SocketDev/socket-registry.git",
"directory": "packages/npm/stop-iteration-iterator"
},
"files": [
"*.d.ts",
"*.js"
],
"sideEffects": false,
"exports": {
".": {
"types": "./index.d.ts",
"default": "./index.js"
},
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
"access": "public",
"provenance": true
},
"files": []
}
"engines": {
"node": ">=24"
},
"socket": {
"categories": [
"cleanup"
]
}
}
# @socketregistry/stop-iteration-iterator
Placeholder to reserve the name for npm trusted publishing. Real releases publish via CI (OIDC/provenance).
[![Socket Badge](https://socket.dev/api/badge/npm/package/@socketregistry/stop-iteration-iterator)](https://socket.dev/npm/package/@socketregistry/stop-iteration-iterator)
[![CI - @socketregistry/stop-iteration-iterator](https://github.com/SocketDev/socket-registry/actions/workflows/ci.yml/badge.svg)](https://github.com/SocketDev/socket-registry/actions/workflows/ci.yml)
[![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
[![Follow @socket.dev on Bluesky](https://img.shields.io/badge/Follow-@socket.dev-1DA1F2?style=social&logo=bluesky)](https://bsky.app/profile/socket.dev)
> A tested zero dependency drop-in replacement of [`stop-iteration-iterator`](https://socket.dev/npm/package/stop-iteration-iterator) complete with TypeScript types.
## Installation
### Install as a package override
[`socket`](https://socket.dev/npm/package/socket)
CLI will automagically ✨ populate
[overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides)
and [resolutions](https://yarnpkg.com/configuration/manifest#resolutions)
of your `package.json`.
```sh
pnpm install -g socket@1.1.147
socket optimize
```
Prefer to do it yourself? Add `@socketregistry/stop-iteration-iterator`
to your `package.json`.
```json
{
"overrides": {
"stop-iteration-iterator": "npm:@socketregistry/stop-iteration-iterator@^1"
},
"resolutions": {
"stop-iteration-iterator": "npm:@socketregistry/stop-iteration-iterator@^1"
}
}
```
### Install as a plain dependency
Install with your favorite package manager.
```sh
pnpm install @socketregistry/stop-iteration-iterator
```
## Requirements
Node >= `24`