Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shades

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shades - npm Package Compare versions

Comparing version 2.0.0-beta.4 to 2.0.0-beta.5

2

package.json
{
"name": "shades",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"description": "Lens-like functionality with a lodash-style interface.",

@@ -5,0 +5,0 @@ "main": "lib/bundle.js",

@@ -44,6 +44,8 @@ import {

// prettier-ignore
interface Settings {
permissions: "visible" | "private";
permissions: 'visible' | 'private';
lastLogin: Date;
}
interface Post {

@@ -61,2 +63,3 @@ title: string;

settings: Settings;
bestFriend?: User;
}

@@ -75,8 +78,8 @@

filter((user: User) => user.friends.length > 0)(users); // $ExpectType User[]
filter((user: User) => user.name)(byName); // $ExpectType { [key: string]: User; }
filter((user: User) => user.name)(byName); // $ExpectType { [name: string]: User; }
filter("name")(users); // $ExpectType User[]
filter("name")(byName); // $ExpectType { [key: string]: User; }
filter("name")(byName); // $ExpectType { [name: string]: User; }
filter("butts")(users); // $ExpectError
filter({ name: "john" })(users); // $ExpectType User[]
filter({ name: "john" })(byName); // $ExpectType { [key: string]: User; }
filter({ name: "john" })(byName); // $ExpectType { [name: string]: User; }
filter({

@@ -91,6 +94,8 @@ settings: (settings: string) => settings

map("name")(byName); // $ExpectType { [key: string]: string; }
map("not-a-key")(users); // $ExpectType never
map("not-a-key")(byName); // $ExpectType never
map("not-a-key")(users); // $ExpectError
map("not-a-key")(byName); // $ExpectError
map("bestFriend")(users); // $ExpectType (User | undefined)[]
const usersFriends = map("friends")(users); // $ExpectType User[][]
map(1)(usersFriends); // $ExpectType User[]
map(1)(users); // $ExpectError
const usersFriendsByName = map("friends")(byName); // $ExpectType { [key: string]: User[]; }

@@ -112,4 +117,5 @@ map(2)(usersFriendsByName); // $ExpectType { [key: string]: User; }

find("name")(users); // $ExpectedType User | undefined
find((user: User) => user.friends); // $ExpectedType User | undefined
find("name")(users); // $ExpectType User | undefined
find("fart")(users); // $ExpectError
find((user: User) => user.friends)(users); // $ExpectType User | undefined
find((user: User) => user.friends.length > 0)(users); // $ExpectType User | undefined

@@ -135,4 +141,4 @@ find({ name: "barg" })(users); // $ExpectType User | undefined

some("name")(users); // $ExpectedType boolean
some((user: User) => user.friends); // $ExpectedType boolean
some("name")(users); // $ExpectType boolean
some((user: User) => user.friends)(users); // $ExpectType boolean
some((user: User) => user.friends.length > 0)(users); // $ExpectType boolean

@@ -139,0 +145,0 @@ some({ name: "barg" })(users); // $ExpectType boolean

@@ -12,18 +12,2 @@ // TypeScript Version: 3.1

// prettier-ignore
export type KeyedFunctor<K extends string, F> =
F extends Array<HasKey<K>> ? Array<F[number][K]> :
F extends Map<infer A, infer V> ? Map<A, KeyAt<V, K>> :
F extends Set<infer V> ? Set<KeyAt<V, K>> :
F extends Promise<infer V> ? Promise<KeyAt<V, K>> :
F extends { [key: string]: HasKey<K> } ? { [key: string]: F[string][K] } :
F extends Array<HasKey<K>> ? Array<F[number][K]> :
never;
// prettier-ignore
export type IndexFunctor<F> =
F extends Array<Array<infer A>> ? A[] :
F extends { [n: string]: Array<infer A> } ? { [key: string]: A } :
never;
// prettier-ignore
export type Unpack<F> =

@@ -41,7 +25,12 @@ F extends Array<infer A> ? A :

export type HasKey<K extends string, V = any> = { [_ in K]: V };
export type KeyAt<T, K extends string> = T extends { [_ in K]: any }
? T[K]
: never;
export type HasKey<K extends string, V = any> =
| { [_ in K]: V }
| { [_ in K]?: V };
// prettier-ignore
export type KeyAt<T, K extends string> =
T extends { [_ in K]: any } ? T[K] :
T extends { [_ in K]?: any } ? (T[K] | undefined) :
never;
export type Collection<V, K = any> =

@@ -48,0 +37,0 @@ | V[]

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc