@dlghq/dialog-utils
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -7,4 +7,4 @@ /* | ||
// for assets: images, sounds, etc. | ||
declare module "AssetModule" { | ||
declare module 'AssetModule' { | ||
declare module.exports: string; | ||
} |
@@ -7,6 +7,6 @@ /* | ||
// for css imports | ||
declare module "CSSModule" { | ||
declare module 'CSSModule' { | ||
declare module.exports: { | ||
[key: string]: string | ||
[key: string]: string, | ||
}; | ||
} |
@@ -6,3 +6,3 @@ /* | ||
declare module "classnames" { | ||
declare module 'classnames' { | ||
declare type ClassName = string | null | void | { [key: string]: boolean }; | ||
@@ -9,0 +9,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
declare module "favico.js" { | ||
declare module 'favico.js' { | ||
declare type FavicoOptions = { | ||
@@ -18,7 +18,7 @@ // Badge background color | ||
// Badge shape | ||
type?: "circle" | "rectangle", | ||
type?: 'circle' | 'rectangle', | ||
// Badge position | ||
position?: "up" | "down" | "left" | "upleft", | ||
position?: 'up' | 'down' | 'left' | 'upleft', | ||
// Badge animation type | ||
animation?: "slide" | "fade" | "pop" | "popFade" | "none" | "slide", | ||
animation?: 'slide' | 'fade' | 'pop' | 'popFade' | 'none' | 'slide', | ||
// Image element ID if there is need to attach badge to regular image | ||
@@ -29,3 +29,3 @@ elementId?: false | string, | ||
// Method that will be called for each animation from with data URI parameter | ||
dataUrl?: false | string | ||
dataUrl?: false | string, | ||
}; | ||
@@ -39,4 +39,4 @@ | ||
image(value: HTMLImageElement): void; | ||
video(value: HTMLVideoElement | "stop"): void; | ||
webcam(action?: "stop"): void; | ||
video(value: HTMLVideoElement | 'stop'): void; | ||
webcam(action?: 'stop'): void; | ||
} | ||
@@ -43,0 +43,0 @@ |
@@ -5,3 +5,3 @@ type JestMockFn = { | ||
calls: Array<Array<any>>, | ||
instances: mixed | ||
instances: mixed, | ||
}, | ||
@@ -13,7 +13,7 @@ mockClear(): Function, | ||
mockReturnValue(value: any): JestMockFn, | ||
mockReturnValueOnce(value: any): JestMockFn | ||
mockReturnValueOnce(value: any): JestMockFn, | ||
}; | ||
type JestAsymmetricEqualityType = { | ||
asymmetricMatch(value: mixed): boolean | ||
asymmetricMatch(value: mixed): boolean, | ||
}; | ||
@@ -28,3 +28,3 @@ | ||
mostRecent(): mixed, | ||
reset(): void | ||
reset(): void, | ||
}; | ||
@@ -36,3 +36,3 @@ | ||
tick(): void, | ||
uninstall(): void | ||
uninstall(): void, | ||
}; | ||
@@ -42,3 +42,3 @@ | ||
message?: string | (() => string), | ||
pass: boolean | ||
pass: boolean, | ||
}; | ||
@@ -75,7 +75,7 @@ | ||
toThrowError(message?: string | Error | RegExp): void, | ||
toThrowErrorMatchingSnapshot(): void | ||
toThrowErrorMatchingSnapshot(): void, | ||
}; | ||
type JestSpyType = { | ||
calls: JestCallsType | ||
calls: JestCallsType, | ||
}; | ||
@@ -91,3 +91,3 @@ | ||
only(name: string, fn: Function): ?Promise<void>, | ||
skip(name: string, fn: Function): ?Promise<void> | ||
skip(name: string, fn: Function): ?Promise<void>, | ||
}; | ||
@@ -103,3 +103,3 @@ declare function fit(name: string, fn: Function): ?Promise<void>; | ||
(value: any): JestExpectType, | ||
extend(matchers: { [name: string]: JestMatcher }): void | ||
extend(matchers: { [name: string]: JestMatcher }): void, | ||
}; | ||
@@ -135,3 +135,3 @@ | ||
useFakeTimers(): void, | ||
useRealTimers(): void | ||
useRealTimers(): void, | ||
}; | ||
@@ -147,3 +147,3 @@ | ||
objectContaining(value: Object): void, | ||
stringMatching(value: string): void | ||
stringMatching(value: string): void, | ||
}; |
@@ -6,3 +6,3 @@ /* | ||
declare module "photoswipe" { | ||
declare module 'photoswipe' { | ||
declare type PhotoSwipeItem = { | ||
@@ -13,3 +13,3 @@ src: string, | ||
id: string, | ||
fileName: ?string | ||
fileName: ?string, | ||
}; | ||
@@ -20,3 +20,3 @@ | ||
y: number, | ||
w: number | ||
w: number, | ||
}; | ||
@@ -51,3 +51,3 @@ | ||
isClickableElement?: (element: HTMLElement) => boolean, | ||
modal?: boolean | ||
modal?: boolean, | ||
}; | ||
@@ -57,3 +57,3 @@ | ||
x: number, | ||
y: number | ||
y: number, | ||
}; | ||
@@ -77,3 +77,3 @@ | ||
items: PhotoSwipeItem[], | ||
options: PhotoSwipeOptions | ||
options: PhotoSwipeOptions, | ||
): void; | ||
@@ -94,3 +94,3 @@ | ||
easing?: Function, | ||
update?: Function | ||
update?: Function, | ||
): void; | ||
@@ -107,28 +107,28 @@ applyZoomPan(zoomLevel: number, panX: number, panY: number): void; | ||
// events | ||
listen(event: "beforeChange", listener: () => void): void; | ||
listen(event: "afterChange", listener: () => void): void; | ||
listen(event: 'beforeChange', listener: () => void): void; | ||
listen(event: 'afterChange', listener: () => void): void; | ||
listen( | ||
event: "imageLoadComplete", | ||
listener: (index: number, item: PhotoSwipeItem) => void | ||
event: 'imageLoadComplete', | ||
listener: (index: number, item: PhotoSwipeItem) => void, | ||
): void; | ||
listen(event: "resize", listener: () => void): void; | ||
listen(event: 'resize', listener: () => void): void; | ||
listen( | ||
event: "gettingData", | ||
listener: (index: number, item: PhotoSwipeItem) => void | ||
event: 'gettingData', | ||
listener: (index: number, item: PhotoSwipeItem) => void, | ||
): void; | ||
listen(event: "mouseUsed", listener: () => void): void; | ||
listen(event: "initialZoomIn", listener: () => void): void; | ||
listen(event: "initialZoomInEnd", listener: () => void): void; | ||
listen(event: "initialZoomOut", listener: () => void): void; | ||
listen(event: "initialZoomOutEnd", listener: () => void): void; | ||
listen(event: 'mouseUsed', listener: () => void): void; | ||
listen(event: 'initialZoomIn', listener: () => void): void; | ||
listen(event: 'initialZoomInEnd', listener: () => void): void; | ||
listen(event: 'initialZoomOut', listener: () => void): void; | ||
listen(event: 'initialZoomOutEnd', listener: () => void): void; | ||
listen( | ||
event: "parseVerticalMargin", | ||
listener: (item: PhotoSwipeItem) => void | ||
event: 'parseVerticalMargin', | ||
listener: (item: PhotoSwipeItem) => void, | ||
): void; | ||
listen(event: "close", listener: () => void): void; | ||
listen(event: "unbindEvents", listener: () => void): void; | ||
listen(event: "destroy", listener: () => void): void; | ||
listen(event: 'close', listener: () => void): void; | ||
listen(event: 'unbindEvents', listener: () => void): void; | ||
listen(event: 'destroy', listener: () => void): void; | ||
listen( | ||
event: "updateScrollOffset", | ||
listener: (offset: Point) => void | ||
event: 'updateScrollOffset', | ||
listener: (offset: Point) => void, | ||
): void; | ||
@@ -135,0 +135,0 @@ } |
@@ -6,3 +6,3 @@ /* | ||
declare module "react-transition-group/CSSTransitionGroup" { | ||
declare module 'react-transition-group/CSSTransitionGroup' { | ||
declare type ReactCSSTransitionGroupNames = { | ||
@@ -14,3 +14,3 @@ enter?: string, | ||
appear?: string, | ||
appearActive?: string | ||
appearActive?: string, | ||
}; | ||
@@ -27,3 +27,3 @@ | ||
transitionEnterTimeout?: number, | ||
transitionLeaveTimeout?: number | ||
transitionLeaveTimeout?: number, | ||
}; | ||
@@ -34,3 +34,3 @@ | ||
transitionEnter: boolean, | ||
transitionLeave: boolean | ||
transitionLeave: boolean, | ||
}; | ||
@@ -37,0 +37,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
declare module "redux-batched-actions" { | ||
declare module 'redux-batched-actions' { | ||
// this hack needs for simpler type coverage | ||
@@ -13,3 +13,3 @@ declare function batchActions<A1, A2>(actions: [A1, A2]): A2; | ||
declare function batchActions<A1, A2, A3, A4, A5>( | ||
actions: [A1, A2, A3, A4, A5] | ||
actions: [A1, A2, A3, A4, A5], | ||
): A5; | ||
@@ -16,0 +16,0 @@ |
{ | ||
"name": "@dlghq/dialog-utils", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "A collection of utility libraries used by Dialog projects.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -14,5 +14,5 @@ # Dialog JavaScript utils | ||
```js | ||
import { isElectron } from "@dlghq/dialog-utils"; | ||
import { isElectron } from '@dlghq/dialog-utils'; | ||
console.log("isElectron: ", isElectron()); | ||
console.log('isElectron: ', isElectron()); | ||
``` | ||
@@ -23,6 +23,6 @@ | ||
```js | ||
import { Field } from "@dlghq/dialog-utils"; | ||
import { Field } from '@dlghq/dialog-utils'; | ||
Field.create({ value: "" }) | ||
.map(value => "foo") | ||
Field.create({ value: '' }) | ||
.map((value) => 'foo') | ||
.flatMap((value, error, pending) => new Field(value, error, true)) | ||
@@ -37,6 +37,6 @@ .render((value, error, pending) => ( | ||
dispatch, | ||
type: "@@dialog/USER_CONTACT_ADD", | ||
type: '@@dialog/USER_CONTACT_ADD', | ||
context: uid, | ||
action: messenger.contacts.add(uid), | ||
initialState: null | ||
initialState: null, | ||
}); | ||
@@ -43,0 +43,0 @@ }; |
@@ -5,9 +5,9 @@ /* | ||
import { calculateCursor } from "../calculateCursor"; | ||
import { calculateCursor } from '../calculateCursor'; | ||
describe("calculateCursor", () => { | ||
describe('calculateCursor', () => { | ||
const min = 0; | ||
const max = 2; | ||
it("should correctly calculate cursor", () => { | ||
it('should correctly calculate cursor', () => { | ||
expect(calculateCursor({ min, max, next: min - 1 })).toBe(min); | ||
@@ -20,3 +20,3 @@ expect(calculateCursor({ min, max, next: min })).toBe(min); | ||
it("should correctly calculate looped cursor", () => { | ||
it('should correctly calculate looped cursor', () => { | ||
const looped = true; | ||
@@ -23,0 +23,0 @@ expect(calculateCursor({ min, max, looped, next: min - 1 })).toBe(max); |
@@ -6,13 +6,13 @@ /* | ||
import { filterByQuery } from "../filterByQuery"; | ||
import { filterByQuery } from '../filterByQuery'; | ||
describe("filterByQuery", () => { | ||
const users = [{ id: 1, name: "Alexey" }, { id: 2, name: "Lexy" }]; | ||
describe('filterByQuery', () => { | ||
const users = [{ id: 1, name: 'Alexey' }, { id: 2, name: 'Lexy' }]; | ||
it("should sort result", () => { | ||
expect(filterByQuery("le", users, user => user.name)).toEqual([ | ||
{ id: 2, name: "Lexy" }, | ||
{ id: 1, name: "Alexey" } | ||
it('should sort result', () => { | ||
expect(filterByQuery('le', users, (user) => user.name)).toEqual([ | ||
{ id: 2, name: 'Lexy' }, | ||
{ id: 1, name: 'Alexey' }, | ||
]); | ||
}); | ||
}); |
@@ -5,8 +5,8 @@ /* | ||
import { mapNotNull } from "../mapNotNull"; | ||
import { mapNotNull } from '../mapNotNull'; | ||
describe("mapNotNull", () => { | ||
it("should correctly filter values", () => { | ||
expect(mapNotNull([1, null, 2], val => val)).toEqual([1, 2]); | ||
describe('mapNotNull', () => { | ||
it('should correctly filter values', () => { | ||
expect(mapNotNull([1, null, 2], (val) => val)).toEqual([1, 2]); | ||
}); | ||
}); |
@@ -10,3 +10,3 @@ /* | ||
next: number, | ||
looped?: boolean | ||
looped?: boolean, | ||
}; | ||
@@ -13,0 +13,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
import type { List } from "immutable"; | ||
import type { List } from 'immutable'; | ||
@@ -12,3 +12,3 @@ export type Filterable<T> = Array<T> | List<T>; | ||
function normalize(text) { | ||
return text.toLowerCase().replace(/ё/g, "е"); | ||
return text.toLowerCase().replace(/ё/g, 'е'); | ||
} | ||
@@ -22,3 +22,3 @@ | ||
items: C, | ||
getValue: (item: T) => string | ||
getValue: (item: T) => string, | ||
): C { | ||
@@ -28,3 +28,3 @@ const normalQuery = normalize(query); | ||
return items | ||
.map(item => { | ||
.map((item) => { | ||
const value = normalize(getValue(item)); | ||
@@ -34,3 +34,3 @@ | ||
item, | ||
score: value.indexOf(normalQuery) | ||
score: value.indexOf(normalQuery), | ||
}; | ||
@@ -37,0 +37,0 @@ }) |
@@ -7,3 +7,3 @@ /* | ||
function pad(num: number): string { | ||
return num < 10 ? "0" + num : String(num); | ||
return num < 10 ? '0' + num : String(num); | ||
} | ||
@@ -18,3 +18,3 @@ | ||
return pad(minutes) + ":" + pad(seconds); | ||
return pad(minutes) + ':' + pad(seconds); | ||
} |
@@ -7,3 +7,3 @@ /* | ||
const thresh = 1024; | ||
const units = ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | ||
const units = ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | ||
@@ -15,3 +15,3 @@ /** | ||
if (bytes < thresh) { | ||
return bytes + " B"; | ||
return bytes + ' B'; | ||
} | ||
@@ -21,3 +21,3 @@ | ||
units.length, | ||
Math.floor(Math.log(bytes) / Math.log(thresh)) | ||
Math.floor(Math.log(bytes) / Math.log(thresh)), | ||
); | ||
@@ -27,3 +27,3 @@ | ||
return result.toFixed(1) + " " + units[exp - 1]; | ||
return result.toFixed(1) + ' ' + units[exp - 1]; | ||
} |
@@ -6,19 +6,19 @@ /* | ||
import forIn from "lodash/forIn"; | ||
import isPlainObject from "lodash/isPlainObject"; | ||
import forIn from 'lodash/forIn'; | ||
import isPlainObject from 'lodash/isPlainObject'; | ||
export type JSONSchemaProperty = { | ||
type: "string" | "number" | "integer" | "boolean", | ||
title: string | ||
type: 'string' | 'number' | 'integer' | 'boolean', | ||
title: string, | ||
}; | ||
export type JSONSchema = { | ||
type: "object", | ||
type: 'object', | ||
properties: { | ||
[name: string]: JSONSchemaProperty | ||
} | ||
[name: string]: JSONSchemaProperty, | ||
}, | ||
}; | ||
export type JSONValue = { | ||
[key: string]: mixed | ||
[key: string]: mixed, | ||
}; | ||
@@ -30,7 +30,7 @@ | ||
if (!isPlainObject(object)) { | ||
throw new Error("Schema is not a plain object"); | ||
throw new Error('Schema is not a plain object'); | ||
} | ||
if (!isPlainObject(object.properties)) { | ||
throw new Error("Schema properties is not a plain object"); | ||
throw new Error('Schema properties is not a plain object'); | ||
} | ||
@@ -41,3 +41,3 @@ | ||
forIn(object.properties, (value: mixed, key: string) => { | ||
if (typeof value !== "object" || !value) { | ||
if (typeof value !== 'object' || !value) { | ||
throw new Error(`Schema property "${key}" is not a plain object`); | ||
@@ -48,6 +48,6 @@ } | ||
if ( | ||
type !== "string" && | ||
type !== "number" && | ||
type !== "integer" && | ||
type !== "boolean" | ||
type !== 'string' && | ||
type !== 'number' && | ||
type !== 'integer' && | ||
type !== 'boolean' | ||
) { | ||
@@ -57,3 +57,3 @@ throw new Error(`Schema property "${key}" has unsupported type`); | ||
if (typeof title !== "string") { | ||
if (typeof title !== 'string') { | ||
throw new Error(`Schema property "${key}" title is not a string"`); | ||
@@ -66,4 +66,4 @@ } | ||
return { | ||
type: "object", | ||
properties | ||
type: 'object', | ||
properties, | ||
}; | ||
@@ -74,3 +74,3 @@ } | ||
text: string, | ||
onError?: (error: Error) => void | ||
onError?: (error: Error) => void, | ||
): ?JSONSchema { | ||
@@ -90,3 +90,3 @@ try { | ||
text: string, | ||
onError?: (error: Error) => void | ||
onError?: (error: Error) => void, | ||
): ?JSONValue { | ||
@@ -93,0 +93,0 @@ try { |
@@ -11,3 +11,3 @@ /* | ||
array: Array<T>, | ||
mapper: (item: T, index: number) => ?R | ||
mapper: (item: T, index: number) => ?R, | ||
): R[] { | ||
@@ -17,3 +17,3 @@ const result: R[] = []; | ||
const value: ?R = mapper(array[i], i); | ||
if (value !== null && typeof value !== "undefined") { | ||
if (value !== null && typeof value !== 'undefined') { | ||
result.push(value); | ||
@@ -20,0 +20,0 @@ } |
@@ -14,7 +14,7 @@ /* | ||
file: Blob, | ||
callback: (dataUri: string) => void | ||
callback: (dataUri: string) => void, | ||
): void { | ||
const reader = new FileReader(); | ||
reader.onload = event => callback(event.target.result); | ||
reader.onload = (event) => callback(event.target.result); | ||
reader.readAsDataURL(file); | ||
} |
@@ -10,3 +10,3 @@ /* | ||
export function hasSelection(): boolean { | ||
if (typeof document !== "undefined") { | ||
if (typeof document !== 'undefined') { | ||
const selection = document.getSelection(); | ||
@@ -13,0 +13,0 @@ |
@@ -6,4 +6,23 @@ /* | ||
import { isPassiveListenerSupports } from "../support/isPassiveListenerSupports"; | ||
import { isPassiveListenerSupports } from '../support/isPassiveListenerSupports'; | ||
type EventHandler = (event: Event) => mixed; | ||
type EventListener = { handleEvent: EventHandler } | EventHandler; | ||
type EventListenerOptionsOrUseCapture = { | ||
capture?: boolean, | ||
passive?: boolean, | ||
}; | ||
interface ListenFn { | ||
( | ||
target: EventTarget, | ||
type: string, | ||
listener: EventListener, | ||
optionsOrUseCapture: EventListenerOptionsOrUseCapture, | ||
): { | ||
remove: () => mixed, | ||
}; | ||
} | ||
/** | ||
@@ -21,23 +40,20 @@ * Adds DOM event listener. | ||
*/ | ||
export function listen( | ||
target: HTMLElement, | ||
eventType: string, | ||
// $FlowFixMe | ||
listener, | ||
options: { | ||
capture?: boolean, | ||
passive?: boolean | ||
} | ||
export const listen: ListenFn = function listen( | ||
target, | ||
eventType, | ||
handler, | ||
opts = { capture: false, passive: false }, | ||
) { | ||
const { passive = false, capture = false } = options; | ||
const opts = | ||
passive && isPassiveListenerSupports() ? { passive, capture } : capture; | ||
const options = | ||
opts.passive && isPassiveListenerSupports() | ||
? { passive: opts.passive, capture: opts.capture } | ||
: opts.capture; | ||
target.addEventListener(eventType, listener, opts); | ||
target.addEventListener(eventType, handler, options); | ||
return { | ||
remove() { | ||
target.removeEventListener(eventType, listener, opts); | ||
} | ||
target.removeEventListener(eventType, handler, options); | ||
}, | ||
}; | ||
} | ||
}; |
@@ -16,6 +16,6 @@ /* | ||
multiple?: boolean, | ||
accept?: string | ||
accept?: string, | ||
) { | ||
const input = document.createElement("input"); | ||
input.type = "file"; | ||
const input = document.createElement('input'); | ||
input.type = 'file'; | ||
input.multiple = Boolean(multiple); | ||
@@ -22,0 +22,0 @@ if (accept) { |
@@ -6,4 +6,4 @@ /* | ||
import Field, { type FieldAction } from "./redux/field"; | ||
import type { EmptyAction } from "./redux/action"; | ||
import Field, { type FieldAction } from './redux/field'; | ||
import type { EmptyAction } from './redux/action'; | ||
@@ -13,17 +13,17 @@ /** | ||
*/ | ||
export { mapNotNull } from "./core/mapNotNull"; | ||
export { calculateCursor } from "./core/calculateCursor"; | ||
export { filterByQuery } from "./core/filterByQuery"; | ||
export { formatTime } from "./core/formatTime"; | ||
export { getReadableFileSize } from "./core/getReadableFileSize"; | ||
export { mapNotNull } from './core/mapNotNull'; | ||
export { calculateCursor } from './core/calculateCursor'; | ||
export { filterByQuery } from './core/filterByQuery'; | ||
export { formatTime } from './core/formatTime'; | ||
export { getReadableFileSize } from './core/getReadableFileSize'; | ||
export { | ||
parseJSONSchema, | ||
safelyParseJSONSchema, | ||
safelyParseJSON | ||
} from "./core/JSONSchema"; | ||
safelyParseJSON, | ||
} from './core/JSONSchema'; | ||
export type { | ||
JSONSchemaProperty, | ||
JSONSchema, | ||
JSONValue | ||
} from "./core/JSONSchema"; | ||
JSONValue, | ||
} from './core/JSONSchema'; | ||
@@ -33,7 +33,7 @@ /** | ||
*/ | ||
export { listen } from "./dom/listen"; | ||
export { fileToBase64 } from "./dom/fileToBase64"; | ||
export { selectFiles } from "./dom/selectFiles"; | ||
export { selectText } from "./dom/selectText"; | ||
export { hasSelection } from "./dom/hasSelection"; | ||
export { listen } from './dom/listen'; | ||
export { fileToBase64 } from './dom/fileToBase64'; | ||
export { selectFiles } from './dom/selectFiles'; | ||
export { selectText } from './dom/selectText'; | ||
export { hasSelection } from './dom/hasSelection'; | ||
@@ -43,3 +43,3 @@ /** | ||
*/ | ||
export { isElectron } from "./support/isElectron"; | ||
export { isElectron } from './support/isElectron'; | ||
@@ -46,0 +46,0 @@ /** |
@@ -7,3 +7,3 @@ /* | ||
export type EmptyAction<Type: string> = { | ||
type: Type | ||
type: Type, | ||
}; |
@@ -11,4 +11,4 @@ /* | ||
meta: { | ||
context: Context | ||
} | ||
context: Context, | ||
}, | ||
}; | ||
@@ -21,3 +21,3 @@ | ||
dispatch: (action: FieldAction<Type, State, Context>) => void, | ||
initialState: State | ||
initialState: State, | ||
}; | ||
@@ -35,3 +35,3 @@ | ||
dispatch, | ||
initialState | ||
initialState, | ||
}: DispatchOptions<Type, State, Context>): void { | ||
@@ -41,20 +41,20 @@ dispatch({ | ||
payload: new Field(initialState, null, true), | ||
meta: { context } | ||
meta: { context }, | ||
}); | ||
action.then( | ||
value => { | ||
(value) => { | ||
dispatch({ | ||
type, | ||
payload: new Field(value, null, false), | ||
meta: { context } | ||
meta: { context }, | ||
}); | ||
}, | ||
error => { | ||
(error) => { | ||
dispatch({ | ||
type, | ||
payload: new Field(initialState, error, false), | ||
meta: { context } | ||
meta: { context }, | ||
}); | ||
} | ||
}, | ||
); | ||
@@ -66,7 +66,7 @@ } | ||
error, | ||
pending | ||
pending, | ||
}: { | ||
value: Result, | ||
error?: ?Error, | ||
pending?: boolean | ||
pending?: boolean, | ||
}): Field<Result> { | ||
@@ -83,3 +83,3 @@ return new Field(value, error, pending); | ||
map<Result>( | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result, | ||
): Field<Result> { | ||
@@ -89,3 +89,3 @@ return new Field( | ||
this.error, | ||
this.pending | ||
this.pending, | ||
); | ||
@@ -95,3 +95,3 @@ } | ||
flatMap<Result>( | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result, | ||
): Result { | ||
@@ -102,3 +102,3 @@ return mapper(this.value, this.error, this.pending); | ||
render<Result>( | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result | ||
mapper: (value: State, error: ?Error, pending: boolean) => Result, | ||
): Result { | ||
@@ -105,0 +105,0 @@ return mapper(this.value, this.error, this.pending); |
@@ -6,3 +6,3 @@ /* | ||
const _isElectron = typeof window.require === "function"; | ||
const _isElectron = typeof window.require === 'function'; | ||
@@ -9,0 +9,0 @@ /** |
@@ -10,3 +10,3 @@ /* | ||
// $FlowFixMe | ||
const opts = Object.defineProperty({}, "passive", { | ||
const opts = Object.defineProperty({}, 'passive', { | ||
get() { | ||
@@ -16,6 +16,6 @@ isSupports = true; | ||
return true; | ||
} | ||
}, | ||
}); | ||
window.addEventListener("test", null, opts); | ||
window.addEventListener('test', null, opts); | ||
} catch (e) { | ||
@@ -22,0 +22,0 @@ // do nothing |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28031
908