jin-qu / jinqu Goto Github PK
View Code? Open in Web Editor NEW:mahjong: The ultimate Javascript LINQ API.
License: MIT License
:mahjong: The ultimate Javascript LINQ API.
License: MIT License
Is it possible to use this library but not have it automatically pollute the Array.prototype?
Hi Umut,
Just noticed jinqu appears to not be playing nicely with StackBlitz:
https://stackblitz.com/edit/min-4zwq1w?file=index.ts
If you comment out the "import jinqu" it works.
Thanks,
Ben
The following:
[1,"two",3].ofType(Number)
Won't compile. And even if it could, you really want number
, not Number
.
See:
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html
Repro:
https://stackblitz.com/edit/jinqu-oftype?file=index.ts
Thinking out loud, but the possible categories of types are:
The only category of types that can actually just work here are class types. The other categories don't have runtime type information. One strategy I've eventually become comfortable with in such scenarios has been to allow the caller to provide a default or "guide" type:
[1,"two",3].ofType(0) // numbers
[1,"two",3].ofType("") // strings
For the projects I've worked on, I just use the same directory to publish to npm as to publish to github, so no need to worry about keeping the two in sync. (Sometimes the docs will be slightly less up to date, as sometimes docs are updated in github without an npm publish, but this isn't a big deal).
You can have a .npmignore
file if different from the .gitignore
file.
Getting a large number of warnings when running a web app when using the jinqu package, perhaps due to source map issues, in the Chrome window (pasted below).
If it helps, here's the webpack config that will work with source maps that need double translations (so they go from typescript to javascript, and then javascript to bundled javascript):
https://github.com/solenya-group/solenya-aspnetcore-starter/blob/master/webpack.config.js
So if you reference Solenya package, and hit F12 in chrome, go to the Sources tab, then Page, you can debug Solenya .ts files in the webpack://./node_modules/solenya/src directory
Anyway, here's the warnings:
[HMR] bundle has 12 warnings
./node_modules/jokenizer/dist/lib/ExpressionVisitor.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/ExpressionVisitor.ts': Error: Can't resolve '../../lib/ExpressionVisitor.ts' in 'C:\Code\feesmonthly\node_modules\jokenizer\dist\lib'./node_modules/jinqu/dist/lib/ajax.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/ajax.ts': Error: Can't resolve '../../lib/ajax.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist\lib'./node_modules/jinqu/dist/lib/array-extensions.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/array-extensions.ts': Error: Can't resolve '../../lib/array-extensions.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist\lib'./node_modules/jinqu/dist/lib/array-query-provider.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/array-query-provider.ts': Error: Can't resolve '../../lib/array-query-provider.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist\lib'./node_modules/jokenizer/dist/lib/evaluator.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/evaluator.ts': Error: Can't resolve '../../lib/evaluator.ts' in 'C:\Code\feesmonthly\node_modules\jokenizer\dist\lib'./node_modules/jinqu/dist/lib/query-part.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/query-part.ts': Error: Can't resolve '../../lib/query-part.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist\lib'./node_modules/jinqu/dist/lib/queryable.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/queryable.ts': Error: Can't resolve '../../lib/queryable.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist\lib'./node_modules/jokenizer/dist/lib/tokenizer.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/tokenizer.ts': Error: Can't resolve '../../lib/tokenizer.ts' in 'C:\Code\feesmonthly\node_modules\jokenizer\dist\lib'./node_modules/jokenizer/dist/lib/types.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../../lib/types.ts': Error: Can't resolve '../../lib/types.ts' in 'C:\Code\feesmonthly\node_modules\jokenizer\dist\lib'./node_modules/jinqu/dist/index.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../index.ts': Error: Can't resolve '../index.ts' in 'C:\Code\feesmonthly\node_modules\jinqu\dist'./node_modules/jokenizer/dist/index.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file '../index.ts': Error: Can't resolve '../index.ts' in 'C:\Code\feesmonthly\node_modules\jokenizer\dist'./node_modules/reflect-metadata/Reflect.jsModule Warning (from ./node_modules/source-map-loader/index.js):(Emitted value instead of an instance of Error) Cannot find source file 'Reflect.ts': Error: Can't resolve './Reflect.ts' in 'C:\Code\feesmonthly\node_modules\reflect-metadata'
There is no change to affect coveralls recently, but it suddenly stopped working.
Examine and fix or switch to codecov.
Apologies for logging an issue for what might just be a documentation question, but what's the purpose of asQueryable
(and q
)?
In other words, what's the difference between these two lines:
[1,2,3].where (x => x % 2 == 0)
[1,2,3].asQueryable().where (x => x % 2 == 0)
Not sure if I have a mental block here, but I'm wondering why this is necessary:
const filtered = orders.where('c => c.id > value', { value: 3 })
As opposed to simply using string interpolation:
const value = 3
const filtered = orders.where(`c => c.id > ${value}`)
A very common pattern is to have a function ending with toArray
. My expectation was that the type signature would be T[]
, but the type signature is an intersection type between T[]
and InlineCountInfo
. So have to add boilerplate to explicitly modify the return type, otherwise the signature is polluted. This seems to break the 90/10 principle, as the vast majority of the time you don't care about getting the inline count.
Instead of:
Yet another Linq for JavaScript. Supports string expressions.
"The ultimate Javascript LINQ API"
Cause it's true.
PATCH method is missing in AjaxOptions
1.1.3
Be present
Missing
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.