Gathering detailed insights and metrics for jinqu
Gathering detailed insights and metrics for jinqu
Gathering detailed insights and metrics for jinqu
Gathering detailed insights and metrics for jinqu
npm install jinqu
Typescript
Module System
Node Version
NPM Version
TypeScript (99.14%)
JavaScript (0.86%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
38 Stars
376 Commits
4 Forks
7 Watchers
2 Branches
3 Contributors
Updated on Feb 24, 2025
Latest Version
2.0.0
Package Id
jinqu@2.0.0
Unpacked Size
173.11 kB
Size
26.20 kB
File Count
21
NPM Version
10.1.0
Node Version
20.9.0
Published on
Feb 12, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Jinqu, based on the LINQ design, is the ultimate querying API for Javscript & Typescript. It provides:
jinqu-odata
)Jinqu works perfectly in both Javascript and Typescript, but is optimized for Typescript. Jinqu is itself written in Typescript.
npm install jinqu
First, make sure you've imported jinqu. This will add asQueryable method to Array Prototype.
1import 'jinqu'
We need to call asQueryable to create a query for an Array.
1const array = [1,2,3,4,5] 2const query = array.asQueryable().where(c => n % 2 == 0).toArray() 3for (var n of query) 4 console.log (n) // outputs 2,4
If you want to use query methods directly, you need to install and import jinqu-array-extensions package.
npm i jinqu-array-extensions
1import 'jinqu-array-extensions'
You actually only need to do this once, such as in the entry point for your application, to ensure the Array prototype extensions are set up.
Now let's filter an array:
1const array = [1,2,3,4,5] 2const query = array.where(c => n % 2 == 0).toArray() 3for (var n of query) 4 console.log (n) // outputs 2,4
We can chain query operators:
1const array = [1,2,3,4,5] 2const query = array 3 .where(c => n % 2 == 0) 4 .orderByDescending (n => n) 5 .toArray() 6for (var n of query) 7 console.log (n) // outputs 4,2
Importantly, results aren't evaluated until toArray
is called.
1const filtered = orders.where('c => c.id > value', { value: 3 })
The additional argument is a variable scope that lets you pass in variables dynamically.
The full range of LINQ operators are supported:
1where 2ofType 3cast 4select 5selectMany 6join 7groupJoin 8orderBy 9orderByDescending 10thenBy 11thenByDescending 12take 13takeWhile 14skip 15skipWhile 16groupBy 17distinct 18concat 19zip 20union 21intersect 22except 23defaultIfEmpty 24reverse 25first 26firstOrDefault 27last 28lastOrDefault 29single 30singleOrDefault 31elementAt 32elementAtOrDefault 33contains 34sequenceEqual 35any 36all 37count 38min 39max 40sum 41average 42aggregate 43toArray
As well as:
1ofGuardedType
And also:
1range 2repeat
Jinqu has the following remote providers:
Remote queries always return promises so are awaited. So rather than toArray
to obtain the results of the query, you'll call toArrayAsync
:
1... 2const result = await remoteQuery.toArrayAsync() 3for (var item of result) 4 ...
Jinqu query operators build queries with a simple model: they take a query type as an input, transform it, and output another query type. However, the very first operator in a query needs to take an array type as the original source for the query. To make this work, jinqu extends the Array prototype.
Extending the array prototype is very convenient, but occasionally has conflict issues with Array's built-in prototype or other 3rd party prototype extensions.
To overcome this, you can call asQueryable
or the convenience q
for short, to ensure you're working with an IQuery<T>
type:
1[1,2,3].asQueryable().reverse() 2[1,2,3].q().reverse() // same as above
In addition, the concat
, join
, and reverse
methdos (which are built into the Array prototype), have special support: call concatWith
, joinWith
, and reverseTo
, to start a query with these operators on the array type.
ofType
and ofGuardedType
filter elements of a specified type. The type arguments you must supply are a little different to what you might expect if you come from a C# background, but will make sense to you when you get a feel for the Typescript type system.
ofType
takes either a:
ofGuardedType
takes a:
Their usage is as follows:
1class Panda { 2 constructor (public id: number) {} 3} 4 5function isNumber(x: any): x is number { 6 return typeof x === "number" 7} 8 9const array = ["1", 2, new Panda(3), "4", 5, new Panda(6)] 10const justPandas = array.ofType(Panda) // panda 3, panda 6 - using constructor type filter 11const justStrings = array.ofType("") // "1", "4" - using default value type filter 12const justNumbers = array.ofGuardedType(isNumber) // 2, 5 - using type guard filter
jinqu is licensed with the MIT License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More