Comments (5)
yep, but in the end, having special comparer for those cases is user's responsibility.
I think the best we can do is use ===
as default (every other method in the library uses this comparer)
I also edited my previous answer
from linq-collections.
Since EqualityComparer is there already, I'll grab this task.
from linq-collections.
I suppose we will also need to have something like an EqualityComparer
to specify in which way to compare values?
We would have an optional value which would specify in which way to do an intersection. Something like this?
export interface IQueryable<TOut>
{
intersect(other: IQueryable<TOut>, comparer?: EqualityComparer<TOut>): IEnumerable<TOut>;
}
Maybe it would also be a good idea to create comparers for simple types(string, number, etc...) which would be automatically used(depending on the type) if no comparer is specified.
from linq-collections.
The only place where comparers are being used currently is for orderBy
, maybe it's a good idea to introduce a StrictEqualityComparer
that simply does ===
and start using it here as default one?
We can introduce something like this:
export type EqualityComparer<T> = (left: T, right: T) => boolean;
export const StrictEqualityComparer = <T>() => (left: T, right: T) => left === right;
from linq-collections.
It all depends how precise you want to go. I'd argue that for strings, as an example, being careful about locale is a must. And ===
doesn't help in that case.
from linq-collections.
Related Issues (20)
- ToLookup HOT 1
- SequenceEqual
- SkipWhile HOT 2
- Symbol.Iterator and Generators support HOT 3
- Configure webpack + gulp + browser exports
- Zip HOT 1
- DefaultIfEmpty
- Hash and Equality HOT 1
- More overloads using comparers HOT 1
- GroupBy uses inmediate execution instead of deferred HOT 1
- Proper iterator testing
- Add proper deferred execution testing HOT 1
- Fix TsLint HOT 1
- Make List implements IEnumerable HOT 1
- I cloned the source and a error has occur. HOT 5
- warning when building HOT 2
- Is this project still actively maintained or dead? HOT 1
- How to group by multiple keys and select those keys?
- `readonly RowAccessor[]` is not assignable to parameter of type `RowAccessor[]` ?
- Error: No "exports" main defined in ...\node_modules\linq-to-typescript\package.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linq-collections.