bevry / eachr Goto Github PK
View Code? Open in Web Editor NEWDeprecated: Use `for ( const [key, value] of Object.entries(thing) )`
License: Other
Deprecated: Use `for ( const [key, value] of Object.entries(thing) )`
License: Other
Dependabot encountered the following error when parsing your .dependabot/config.yml
:
The property '#/update_configs/0/automerged_updates/0/match/update_type' value "security" did not match one of the following values: all, security:patch, semver:patch, semver:minor, in_range
Please update the config file to conform with Dependabot's specification using our docs and online validator.
Seems it would be possible to have the callback contain the values. Before the v7 typescript rewrite, I had done these types on jan 2 2019, perhaps they can work:
https://github.com/bevry/eachr/blob/381e347bd61b479b87b6309ba1e08112176b395d/source/index.d.ts
declare module 'eachr' {
/** Internal type to make overloading the Subject easier. */
type SubjectType<Key extends keyof any, Value> =
| Array<Value>
| Map<Key, Value>
| Record<Key, Value>
/** Internal type to make overloading the Key easier. */
type KeyType<Subject> = Subject extends any[] ? number : keyof any
/**
* The callback that is called with the details for each iteration of the subject.
* @param this The context is bound to the subject.
* @param value The value of the iteration.
* @param key The key of the iteration.
* @param subject The collection we are iterating.
* @returns Return `false` if you wish to break out of the iteration.
* @example
* ``` javascript
* // stop iterating when we encounter break
* eachr(['hello', 'world', 'break', 'never'], function (value, index) {
* return value === 'break' ? false : console.log(value)
* })
* // ^ logs: hello, world
* ```
*/
export interface IteratorCallback<
Subject extends SubjectType<Key, Value>,
Key extends KeyType<Subject>,
Value
> {
(
this: Subject & SubjectType<Key, Value>,
value: Value,
key: Key,
subject: Subject
): void | boolean
}
/**
* Iterate through an Array, receiving the value and index.
* @example
* ``` javascript
* const arr = [1, 2 'three']
* eachr(arr, (value, key) => {})
* ```
*/
export default function eachr<
Subject extends Array<Value>,
Key extends KeyType<Subject>,
Value
>(
subject: Subject & Array<Value>,
callback: IteratorCallback<Subject, Key, Value>
): typeof subject
/**
* Iterate through an object, receiving the value and key.
* @example
* ``` javascript
* const obj = { a: 1, b: 'two' }
* eachr(obj, (value, key) => {})
* ```
*/
export default function eachr<
Subject extends Record<Key, Value>,
Key extends KeyType<Subject>,
Value extends Subject[Key]
>(
subject: Subject & Record<Key, Value>,
callback: IteratorCallback<Subject, Key, Value>
): Object
/**
* Iterate through a Map, receiving the value and key.
* @example
* ``` javascript
* const map = new Map<string, number | string>().set('a', 1).set('b', 'two')
* eachr(map, (value, key) => {})
* ```
*/
export default function eachr<
Subject extends Map<Key, Value>,
Key extends KeyType<Subject>,
Value
>(
subject: Subject & Map<Key, Value>,
callback: IteratorCallback<Subject, Key, Value>
): typeof subject
/** Iterate through the subject. */
export default function eachr<
Subject extends SubjectType<Key, Value>,
Key extends KeyType<Subject>,
Value
>(
subject: Subject & SubjectType<Key, Value>,
callback: IteratorCallback<Subject, Key, Value>
): typeof subject
}
However, as eachr is legacy tool, I'm not fussed, so closing.
I'm not too fussed, as our test chain doesn't support 0.10... however our runtime code may...
If someone out there still depends on 0.10 support for this, post an issue and I will see what I can do.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.