Skip to content

Commit b4e0d86

Browse files
author
Vlad Balin
committed
Fix problems with React Native
1 parent c25722c commit b4e0d86

File tree

12 files changed

+77
-74
lines changed

12 files changed

+77
-74
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
declare global {
2+
interface ObjectConstructor {
3+
setPrototypeOf(target: Object, proto: Object): any;
4+
}
5+
}
16
export * from './object-plus';
27
export * from './collection';
38
export * from './relations';
49
export * from './record';
510
export * from './transactions';
6-
export { IOEndpoint, IOPromise, createIOPromise } from './io-tools';
11+
export * from './io-tools';
712
export declare const on: any, off: any, trigger: any, once: any, listenTo: any, stopListening: any, listenToOnce: any;
813
import { Record as Model } from './record';
914
import { Mixable as Class } from './object-plus/';

lib/index.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/object-plus/tools.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export declare function defaults<T>(dest: T, ...sources: Object[]): T;
12
export declare type Logger = (level: LogLevel, error: string, props?: object) => void;
23
export declare type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug' | 'log';
34
export interface Log extends Logger {
@@ -26,12 +27,6 @@ export declare function transform<A, B>(dest: {
2627
export declare function fastAssign<A>(dest: A, source: {}): A;
2728
export declare function fastDefaults<A>(dest: A, source: {}): A;
2829
export declare function assign<T>(dest: T, ...sources: Object[]): T;
29-
export declare function defaults<T>(dest: T, ...sources: Object[]): T;
30-
declare global {
31-
interface ObjectConstructor {
32-
setPrototypeOf(target: Object, proto: Object): any;
33-
}
34-
}
3530
export declare function keys(o: any): string[];
3631
export declare function once(func: Function): Function;
3732
export declare function notEqual(a: any, b: any): boolean;

lib/object-plus/tools.js

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/object-plus/tools.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
// Polyfill for IE10. Should fix problems with babel and statics inheritance.
2+
import { tools } from './object-plus'
3+
4+
declare global {
5+
interface ObjectConstructor {
6+
setPrototypeOf( target : Object, proto : Object );
7+
}
8+
}
9+
10+
Object.setPrototypeOf || ( Object.setPrototypeOf = tools.defaults );
11+
112
/**
213
* Export everything
314
*/
15+
416
export * from './object-plus'
517
export * from './collection'
618
export * from './relations'
719
export * from './record'
8-
920
export * from './transactions'
10-
11-
export { IOEndpoint, IOPromise, createIOPromise } from './io-tools'
21+
export * from './io-tools'
1222

1323
// Exported module itself is the global event bus.
1424
import { Events } from './object-plus/'

src/object-plus/tools.ts

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@
66
* exported [[log]] variable.
77
*/
88

9+
/** Similar to underscore `_.defaults` */
10+
export function defaults< T >( dest : T, ...sources : Object[] ) : T
11+
export function defaults< T >( dest : T, source : Object ) : T {
12+
for( var name in source ) {
13+
if( source.hasOwnProperty( name ) && !dest.hasOwnProperty( name ) ) {
14+
dest[ name ] = source[ name ];
15+
}
16+
}
17+
18+
if( arguments.length > 2 ){
19+
for( let i = 2; i < arguments.length; i++ ){
20+
const other = arguments[ i ];
21+
other && defaults( dest, other );
22+
}
23+
}
24+
25+
return dest;
26+
}
27+
928
// Logger is the function.
1029
export type Logger = ( level : LogLevel, error : string, props? : object ) => void;
1130

@@ -259,34 +278,6 @@ export function assign< T >( dest : T, source : Object ) : T {
259278
return dest;
260279
}
261280

262-
/** Similar to underscore `_.defaults` */
263-
export function defaults< T >( dest : T, ...sources : Object[] ) : T
264-
export function defaults< T >( dest : T, source : Object ) : T {
265-
for( var name in source ) {
266-
if( source.hasOwnProperty( name ) && !dest.hasOwnProperty( name ) ) {
267-
dest[ name ] = source[ name ];
268-
}
269-
}
270-
271-
if( arguments.length > 2 ){
272-
for( let i = 2; i < arguments.length; i++ ){
273-
const other = arguments[ i ];
274-
other && defaults( dest, other );
275-
}
276-
}
277-
278-
return dest;
279-
}
280-
281-
// Polyfill for IE10. Should fix problems with babel and statics inheritance.
282-
declare global {
283-
interface ObjectConstructor {
284-
setPrototypeOf( target : Object, proto : Object );
285-
}
286-
}
287-
288-
Object.setPrototypeOf || ( Object.setPrototypeOf = defaults );
289-
290281
/** Similar to underscore `_.keys` */
291282
export function keys( o : any ) : string[]{
292283
return o ? Object.keys( o ) : [];

0 commit comments

Comments
 (0)