{"id":16419086,"url":"https://github.com/neo-ciber94/fastlinq","last_synced_at":"2026-07-08T22:30:16.983Z","repository":{"id":131850288,"uuid":"290352543","full_name":"Neo-Ciber94/fastlinq","owner":"Neo-Ciber94","description":"LINQ for TypeScript","archived":false,"fork":false,"pushed_at":"2020-09-07T21:52:33.000Z","size":334,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T12:30:47.877Z","etag":null,"topics":["functional-programming","iterable","lazy","linq","querying"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Neo-Ciber94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-26T00:14:35.000Z","updated_at":"2020-09-07T23:30:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"8309efad-4367-4f51-9310-e6624d485a2b","html_url":"https://github.com/Neo-Ciber94/fastlinq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-Ciber94%2Ffastlinq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-Ciber94%2Ffastlinq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-Ciber94%2Ffastlinq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neo-Ciber94%2Ffastlinq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neo-Ciber94","download_url":"https://codeload.github.com/Neo-Ciber94/fastlinq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232792143,"owners_count":18577260,"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":["functional-programming","iterable","lazy","linq","querying"],"created_at":"2024-10-11T07:15:52.649Z","updated_at":"2026-07-08T22:30:16.917Z","avatar_url":"https://github.com/Neo-Ciber94.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastlinq.ts\n\nProvides a lazy evaluated type that provides a set of methods for query over the values of a collection. It provides methods for transform, filter, update, combine an iterable or compute a result with the elements of the iterable.\n\n### Getting started\nInstall ```fastlinq``` using npm:\n```\nnpm install fastlinq\n```\n\n### Example\n```ts\nimport './src/Query';\n\nconst numbers = [1,2,3,4,5,6,7,8,9,10];\n\n// Calls Array.asQuery() to get a ```Queryable\u003cT\u003e``` over the elements of the array\nconst items = numbers.asQuery()\n    .filter(e =\u003e e \u003c= 5)     // Filters the elements\n    .map(e =\u003e e * 2)         // Transforms the elements\n    .toArray();              // Gets an array containing the result\n\nconsole.log(items); // [2,4,6,8,10]\n```\n\nAlso you can use the ```Query``` namespace which offers functions for create queries.\n\n```ts\nimport './src/Query';\n\nfor(const e of Query.rangeInclusive(0, 10)){\n    console.log(e);\n}\n// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n```\n\n### Operations\nHere an overview of the fastquery ```API```.\n\n```ts\ninterface Queryable\u003cT\u003e extends Iterable\u003cT\u003e{\n    /// Transform the values of the query.\n    map\u003cTResult\u003e(transform: (value: T) =\u003e TResult) : Queryable\u003cTResult\u003e;\n\n    /// Gets a query with all the values returned in the callback.\n    flatMap\u003cTResult\u003e(transform: (value: T) =\u003e TResult[]) : Queryable\u003cTResult\u003e;\n\n    /// Gets all the values that match the specified condition.\n    filter(predicate: (value: T) =\u003e boolean) : Queryable\u003cT\u003e;\n\n    /// Gets all the values that don't match the specified condition.\n    filterNot(predicate: (value: T) =\u003e boolean) : Queryable\u003cT\u003e;\n\n    /// Drop the first `n` values of the query.\n    skip(n: number) : Queryable\u003cT\u003e;\n\n    /// Takes the first `n` values o fthe query.\n    take(n: number) : Queryable\u003cT\u003e;\n\n    /// Drop values while the specified condition is meet.\n    skipWhile(predicate: (value: T) =\u003e boolean) : Queryable\u003cT\u003e;\n\n    /// Take values while the specified condition is meet.\n    takeWhile(predicate: (value: T) =\u003e boolean) : Queryable\u003cT\u003e;\n\n    /// Takes values from the end of the query.\n    takeLast(count: number) : Queryable\u003cT\u003e;\n\n    /// Drop values from the end of the query.\n    skipLast(count: number) : Queryable\u003cT\u003e;\n\n    /// Returns a new query with the specified value at the end.\n    append(value: T) : Queryable\u003cT\u003e;\n\n    /// Returns a new query with the specified value at the start.\n    prepend(value: T) : Queryable\u003cT\u003e;\n\n    /// Returns a new query with the specified values the end.\n    concat(elements: Iterable\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Returns a new query where all the values had an index.\n    indexed() : Queryable\u003cIndexedValue\u003cT\u003e\u003e;\n\n    /// Returns a new query where all the values have a key provided by the `keySelector`.\n    keyed\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : Queryable\u003cKeyValue\u003cTKey, T\u003e\u003e;\n\n    /// Gets all the distinct values of this query.\n    distinct() : Queryable\u003cT\u003e;\n\n    /// Gets all values that have a different values than the provided by the `keySelector`.\n    distinctBy\u003cTResult\u003e(keySelector: (value: T) =\u003e TResult) : Queryable\u003cT\u003e;\n\n    /// Gets the elements of this query plus provided when that don't exists within.\n    /// Check: https://en.wikipedia.org/wiki/Union_(set_theory)\n    union(elements: Iterable\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Gets all the elements of this query that don't exist in the provided iterable.\n    /// Check: https://en.wikipedia.org/wiki/Complement_(set_theory)\n    except(elements: Iterable\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Gets the elements of this query that also exists in the provided.\n    /// Check: https://en.wikipedia.org/wiki/Intersection_(set_theory)\n    intersect(elements: Iterable\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Reverses the order of the elements in this query.\n    reversed() : Queryable\u003cT\u003e;\n\n    /// Gets a view of the values of this query, where each iteration\n    /// returns the number of elements specified by `chunkSize`.\n    chuncked(chunkSize: number) : Queryable\u003cT[]\u003e;\n\n    /// Gets a view of the values of this query, where each iteration\n    /// return the next number of elements specified by `size`\n    /// Ignoring the first one returned.\n    windowed(size: number) : Queryable\u003cT[]\u003e;\n\n    /// Sorts the elements of this query with an optional `compare`.\n    sort() : Queryable\u003cT\u003e;\n    sort(compare: Compare\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Sorts by decending the elements of this query with an optional `compare`.\n    sortDecending() : Queryable\u003cT\u003e;\n    sortDecending(compare: Compare\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Sorts the elements of this query using the provided value\n    /// and an optional `compare`\n    sortBy\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : Queryable\u003cT\u003e;\n    sortBy\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey, compare: Compare\u003cTKey\u003e) : Queryable\u003cT\u003e;\n\n    /// Sorts by decending the elements of this query using the provided value\n    /// and an optional `compare`\n    sortByDecending\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : Queryable\u003cT\u003e;\n    sortByDecending\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey, compare: Compare\u003cTKey\u003e) : Queryable\u003cT\u003e;\n\n    /// Gets a pair of all the elements of this query and the specified one\n    /// that match the specified predicate.\n    joinBy\u003cTOther\u003e(elements: Iterable\u003cTOther\u003e, selector: (current: T, other: TOther) =\u003e boolean) : Queryable\u003c[T,TOther]\u003e;\n\n    /// Merge the each elements of this query with the provided.\n    zip\u003cTOther, TResult\u003e(elements: Iterable\u003cTOther\u003e, combine: (current: T, other: TOther) =\u003e TResult) : Queryable\u003cTResult\u003e;\n\n    /// Gets this query or the `defaultValue` if is empty.\n    defaultIfEmpty(defaultValue: Iterable\u003cT\u003e) : Queryable\u003cT\u003e;\n\n    /// Gets each `n` elements of this query.\n    stepBy(n: number) : Queryable\u003cT\u003e;\n\n    /// Repeat the elements of this query `n` times.\n    repeat(n: number) : Queryable\u003cT\u003e;\n\n    /// Perform an action over each value of this query and returns this.\n    seek(action: (value: T) =\u003e void) : this;\n\n    /// Perform an action over each value of this query.\n    forEach(action: (value: T) =\u003e void) : void;\n\n    /// Combine the values of this query and gets the result.\n    reduce(reducer: (prev: T, current: T) =\u003e T) : T | undefined;\n    reduce(reducer: (prev: T, current: T) =\u003e T, seed: T) : T;\n\n    /// Provides an initial value and combine the values of this query and get the result.\n    fold\u003cTResult\u003e(initialValue: TResult, combine: (prev: TResult, current: T) =\u003e TResult) : TResult;\n\n    /// Sums the values provided by the specified selector and get the result.\n    sum(selector: (value: T) =\u003e number) : number | undefined;\n\n    /// Multiply the values provided by the specified selector and get the result.\n    product(selector: (value: T) =\u003e number) : number | undefined;\n\n    /// Gets the average of the values provided by the specified selector.\n    average(selector: (value: T) =\u003e number) : number | undefined;\n\n    /// Gets a pair with values that meet the condition and don't.\n    partition(predicate: (value: T) =\u003e boolean) : [T[], T[]];\n\n    /// Gets the minimun value of this query.\n    min() : T | undefined;\n    min(compare: Compare\u003cT\u003e) : T | undefined;\n\n    /// Gets the maximun value of this query.\n    max() : T | undefined;\n    max(compare: Compare\u003cT\u003e) : T | undefined;\n\n    /// Gets the minimun and maximun values of this query.\n    minmax() : [T, T] | undefined;\n    minmax(compare: Compare\u003cT\u003e) : [T, T] | undefined;\n\n    /// Checks if this query contains the specified value.\n    contains(value: T) : boolean;\n    contains(predicate: (value: T) =\u003e boolean) : boolean;\n\n    /// Checks if this query contains all the specified values.\n    containsAll(values: Iterable\u003cT\u003e) : boolean;\n\n    /// Checks if this query have elements in the same other than the other.\n    sequenceEquals(values: Iterable\u003cT\u003e) : boolean;\n\n    /// Gets the element at the specified index.\n    elementAt(index: number) : T | undefined;\n\n    /// Gets the element at the specified index or the default value.\n    elementAtOrElse(index: number, defaultValue: T) : T;\n\n    /// Gets the position of the specified value if found.\n    indexOf(value: T) : number | undefined;\n\n    /// Gets the position of the specified value if found starting from the last.\n    lastIndexOf(value: T) : number | undefined;\n\n    /// Gets the first value of this query if any.\n    first() : T | undefined;\n\n    /// Gets the last value of this query if any.\n    last() : T | undefined;\n\n    /// Gets the first value of this query or the default if not found.\n    firstOrElse(defaultValue: T) : T;\n\n    /// Gets the last value of this query or the default if not found.\n    lastOrElse(defaultValue: T) : T;\n\n    /// Gets the first value that meet the condition.\n    find(predicate: (value: T) =\u003e boolean) : T | undefined;\n\n    /// Gets the last value that meet the condition.\n    findLast(predicate: (value: T) =\u003e boolean) : T | undefined;\n\n    /// Gets the position of the value that meet the condition.\n    findIndex(predicate: (value: T) =\u003e boolean) : number | undefined;\n\n    /// Gets the position of the last value that meet the condition.\n    findLastIndex(predicate: (value: T) =\u003e boolean) : number | undefined;\n\n    /// Gets the position of the values that meet the condition.\n    findIndices(predicate: (value: T) =\u003e boolean) : number[]\n\n    /// Gets the only value of the query, fail if there is more than 1 element.\n    single() : T | undefined;\n\n    /// Gets the only value of the query that meet the condition, \n    /// fail if more than one meet the condition.\n    single(predicate: (value: T) =\u003e boolean) : T | undefined;\n\n    /// Gets the only value of the query, or the default if there is more than 1 element.\n    singleOrElse(defaultValue: T) : T;\n\n    /// Gets the only value of the query that meet the condition, \n    /// or the default if there is more than 1 element.\n    singleOrElse(defaultValue: T, predicate: (value: T) =\u003e boolean) : T;\n\n    /// Check if all the elements in the query meet the condition.\n    every(predicate: (value: T) =\u003e boolean) : boolean;\n\n    /// Check if there is elements in the query.\n    any() : boolean;\n\n    /// Check if any value meet the condition.\n    any(predicate: (value: T) =\u003e boolean) : boolean;\n\n    /// Test if this query is sorted.\n    isSorted() : boolean;\n\n    /// Test if this query is sorted by decending.\n    isSortedDecending() : boolean;\n\n    /// Test if this query is sorted by the specified key.\n    isSortedBy\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : boolean;\n\n    /// Test if this query is sorted by decending by the specified key.\n    isSortedByDecending\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : boolean;\n\n    /// Check if this query have no elements.\n    isEmpty() : boolean;\n\n    /// Gets the number of elements in this query.\n    count() : number;\n\n    /// Gets the number of elements that match the condition.\n    count(predicate: (value: T) =\u003e boolean) : number;\n\n    /// Groups the elements of this query by the given key.\n    groupBy\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : Map\u003cTKey, T[]\u003e;\n\n    /// Gets an array with the elements of this query.\n    toArray() : T[];\n    \n    /// Gets a set with the elements of this query.\n    toSet() : Set\u003cT\u003e;\n\n    /// Gets a map with the elements of this query using the key provided by the given selector.\n    toMap\u003cTKey\u003e(keySelector: (value: T) =\u003e TKey) : Map\u003cTKey, T\u003e;\n\n    /// Gets an string representation of the elements of this query.\n    toString() : string;\n    toString(separator: string) : string;\n    toString(options: ToStringOptions) : string;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-ciber94%2Ffastlinq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo-ciber94%2Ffastlinq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-ciber94%2Ffastlinq/lists"}