fable-core
Advanced tools
Comparing version 0.7.19 to 0.7.20
@@ -527,3 +527,3 @@ import List from "./ListClass"; | ||
type: "Microsoft.FSharp.Collections.FSharpMap", | ||
interfaces: ["System.IEquatable", "System.IComparable"] | ||
interfaces: ["System.IEquatable", "System.IComparable", "System.Collections.Generic.IDictionary"] | ||
}; | ||
@@ -530,0 +530,0 @@ }; |
{ | ||
"name": "fable-core", | ||
"version": "0.7.19", | ||
"version": "0.7.20", | ||
"description": "Fable core lib & bindings for native JS objects, browser and node APIs", | ||
@@ -5,0 +5,0 @@ "main": "Main.js", |
import { equals } from "./Util"; | ||
import { compare, hasInterface } from "./Util"; | ||
import { compare } from "./Util"; | ||
import { permute as arrayPermute } from "./Array"; | ||
@@ -29,3 +29,3 @@ import List from "./ListClass"; | ||
export function getEnumerator(o) { | ||
return hasInterface(o, "System.Collections.Generic.IEnumerable") | ||
return typeof o.GetEnumerator === "function" | ||
? o.GetEnumerator() : new Enumerator(o[Symbol.iterator]()); | ||
@@ -32,0 +32,0 @@ } |
@@ -538,3 +538,3 @@ (function (dependencies, factory) { | ||
type: "Microsoft.FSharp.Collections.FSharpMap", | ||
interfaces: ["System.IEquatable", "System.IComparable"] | ||
interfaces: ["System.IEquatable", "System.IComparable", "System.Collections.Generic.IDictionary"] | ||
}; | ||
@@ -541,0 +541,0 @@ }; |
@@ -38,3 +38,3 @@ (function (dependencies, factory) { | ||
function getEnumerator(o) { | ||
return Util_2.hasInterface(o, "System.Collections.Generic.IEnumerable") | ||
return typeof o.GetEnumerator === "function" | ||
? o.GetEnumerator() : new Enumerator(o[Symbol.iterator]()); | ||
@@ -41,0 +41,0 @@ } |
@@ -87,3 +87,6 @@ (function (dependencies, factory) { | ||
function hasInterface(obj, interfaceName) { | ||
if (typeof obj[Symbol_1.default.reflection] === "function") { | ||
if (interfaceName === "System.Collections.Generic.IEnumerable") { | ||
return typeof obj[Symbol.iterator] === "function"; | ||
} | ||
else if (typeof obj[Symbol_1.default.reflection] === "function") { | ||
var interfaces = obj[Symbol_1.default.reflection]().interfaces; | ||
@@ -319,2 +322,6 @@ return Array.isArray(interfaces) && interfaces.indexOf(interfaceName) > -1; | ||
exports.randomNext = randomNext; | ||
function defaultArg(arg, defaultValue) { | ||
return arg == null ? defaultValue : arg; | ||
} | ||
exports.defaultArg = defaultArg; | ||
}); |
@@ -57,1 +57,2 @@ export interface IComparer<T> { | ||
export declare function randomNext(min: number, max: number): number; | ||
export declare function defaultArg<T>(arg: T, defaultValue: T): T; |
@@ -70,3 +70,6 @@ import FSymbol from "./Symbol"; | ||
export function hasInterface(obj, interfaceName) { | ||
if (typeof obj[FSymbol.reflection] === "function") { | ||
if (interfaceName === "System.Collections.Generic.IEnumerable") { | ||
return typeof obj[Symbol.iterator] === "function"; | ||
} | ||
else if (typeof obj[FSymbol.reflection] === "function") { | ||
var interfaces = obj[FSymbol.reflection]().interfaces; | ||
@@ -286,1 +289,4 @@ return Array.isArray(interfaces) && interfaces.indexOf(interfaceName) > -1; | ||
} | ||
export function defaultArg(arg, defaultValue) { | ||
return arg == null ? defaultValue : arg; | ||
} |
Sorry, the diff of this file is not supported yet
4640350
13308