fable-core
Advanced tools
Comparing version 0.7.26 to 0.7.27
@@ -0,0 +0,0 @@ export function addRangeInPlace(range, xs) { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || function (d, b) { |
@@ -0,0 +0,0 @@ import { Trampoline } from "./AsyncBuilder"; |
@@ -0,0 +0,0 @@ var Trampoline = (function () { |
@@ -0,0 +0,0 @@ import { setType } from "./Symbol"; |
@@ -0,0 +0,0 @@ import { setType } from "../Symbol"; |
@@ -0,0 +0,0 @@ import { fromNumber, fromBits } from "../Long"; |
@@ -0,0 +0,0 @@ import * as Long from "./Long"; |
@@ -0,0 +0,0 @@ import FSymbol from "./Symbol"; |
@@ -0,0 +0,0 @@ import { create as timeSpanCreate } from "./TimeSpan"; |
@@ -0,0 +0,0 @@ import { createDisposable } from "./Util"; |
@@ -0,0 +0,0 @@ import { compare } from "./Util"; |
@@ -0,0 +0,0 @@ export function createFromValue(v) { |
@@ -0,0 +0,0 @@ import List from "./ListClass"; |
@@ -0,0 +0,0 @@ import FSymbol from "./Symbol"; |
@@ -0,0 +0,0 @@ import _Symbol from "./Symbol"; |
@@ -0,0 +0,0 @@ import { defaultCancellationToken } from "./Async"; |
@@ -0,0 +0,0 @@ import List from "./ListClass"; |
@@ -0,0 +0,0 @@ import { createDisposable } from "./Util"; |
{ | ||
"name": "fable-core", | ||
"version": "0.7.26", | ||
"version": "0.7.27", | ||
"description": "Fable core lib & bindings for native JS objects, browser and node APIs", | ||
@@ -5,0 +5,0 @@ "main": "Main.js", |
@@ -0,0 +0,0 @@ # fable-core |
@@ -1,4 +0,19 @@ | ||
import { NonDeclaredType } from "./Util"; | ||
import { NonDeclaredType, getPropertyNames, getDefinition } from "./Util"; | ||
import List from "./List"; | ||
import FSymbol from "./Symbol"; | ||
var MemberInfo = (function () { | ||
function MemberInfo(name, index, declaringType, propertyType, unionFields) { | ||
this.name = name; | ||
this.index = index; | ||
this.declaringType = declaringType; | ||
this.propertyType = propertyType; | ||
this.unionFields = unionFields; | ||
} | ||
MemberInfo.prototype.getUnionFields = function () { | ||
var _this = this; | ||
return this.unionFields.map(function (fi, i) { return new MemberInfo("unknown", i, _this.declaringType, fi); }); | ||
}; | ||
return MemberInfo; | ||
}()); | ||
export { MemberInfo }; | ||
export function resolveGeneric(idx, enclosing) { | ||
@@ -72,2 +87,4 @@ try { | ||
return typ.definition; | ||
case "GenericType": | ||
return getTypeFullName(typ.definition, option); | ||
case "Any": | ||
@@ -84,1 +101,77 @@ default: | ||
} | ||
export function getName(x) { | ||
if (x instanceof MemberInfo) { | ||
return x.name; | ||
} | ||
return getTypeFullName(x, "name"); | ||
} | ||
export function getPrototypeOfType(typ) { | ||
if (typeof typ === "string") { | ||
return null; | ||
} | ||
else if (typ instanceof NonDeclaredType) { | ||
return typ.kind === "GenericType" ? typ.definition.prototype : null; | ||
} | ||
else { | ||
return typ.prototype; | ||
} | ||
} | ||
export function getProperties(typ) { | ||
var proto = getPrototypeOfType(typ); | ||
if (proto != null && typeof proto[FSymbol.reflection] === "function") { | ||
var info_1 = proto[FSymbol.reflection](); | ||
if (info_1.properties) { | ||
return Object.getOwnPropertyNames(info_1.properties) | ||
.map(function (k, i) { return new MemberInfo(k, i, typ, info_1.properties[k]); }); | ||
} | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " doesn't contain property info."); | ||
} | ||
export function getUnionCases(typ) { | ||
var proto = getPrototypeOfType(typ); | ||
if (proto != null && typeof proto[FSymbol.reflection] === "function") { | ||
var info_2 = proto[FSymbol.reflection](); | ||
if (info_2.cases) { | ||
return Object.getOwnPropertyNames(info_2.cases) | ||
.map(function (k, i) { return new MemberInfo(k, i, typ, null, info_2.cases[k]); }); | ||
} | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " doesn't contain union case info."); | ||
} | ||
export function getPropertyValues(obj) { | ||
return getPropertyNames(obj).map(function (k) { return obj[k]; }); | ||
} | ||
export function getUnionFields(obj, typ) { | ||
if (obj != null && typeof obj[FSymbol.reflection] === "function") { | ||
var info = obj[FSymbol.reflection](); | ||
if (info.cases) { | ||
var uci = null, cases = Object.getOwnPropertyNames(info.cases); | ||
for (var i = 0; i < cases.length; i++) { | ||
if (cases[i] === obj.Case) { | ||
uci = new MemberInfo(cases[i], i, typ, null, info.cases[cases[i]]); | ||
break; | ||
} | ||
} | ||
if (uci != null) { | ||
return [uci, obj.Fields]; | ||
} | ||
} | ||
} | ||
throw new Error("Not an F# union type."); | ||
} | ||
export function makeUnion(caseInfo, args) { | ||
var Cons = getDefinition(caseInfo.declaringType); | ||
return new (Cons.bind.apply(Cons, [void 0, caseInfo.name].concat(args)))(); | ||
} | ||
export function getTupleElements(typ) { | ||
if (typ instanceof NonDeclaredType && typ.kind === "Tuple") { | ||
return typ.generics; | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " is not a tuple type."); | ||
} | ||
export function isTupleType(typ) { | ||
if (typ instanceof NonDeclaredType) { | ||
return typ.kind === "Tuple"; | ||
} | ||
return false; | ||
} |
@@ -0,0 +0,0 @@ export function create(pattern, options) { |
@@ -0,0 +0,0 @@ import { equals } from "./Util"; |
@@ -0,0 +0,0 @@ import FableSymbol from "./Symbol"; |
@@ -0,0 +0,0 @@ import List from "./List"; |
@@ -0,0 +0,0 @@ import { toString } from "./Util"; |
@@ -0,0 +0,0 @@ var fableGlobal = function () { |
@@ -0,0 +0,0 @@ import Event from "./Event"; |
@@ -0,0 +0,0 @@ import { compare as utilCompare } from "./Util"; |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(["require", "exports"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ function addRangeInPlace(range, xs) { |
@@ -6,10 +6,11 @@ var __extends = (this && this.__extends) || function (d, b) { | ||
}; | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util"], factory); | ||
} | ||
})(["require", "exports", "./Util"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -16,0 +17,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./AsyncBuilder", "./AsyncBuilder", "./AsyncBuilder", "./AsyncBuilder", "./Choice", "./Choice", "./Seq"], factory); | ||
} | ||
})(["require", "exports", "./AsyncBuilder", "./AsyncBuilder", "./AsyncBuilder", "./AsyncBuilder", "./Choice", "./Choice", "./Seq"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var AsyncBuilder_1 = require("./AsyncBuilder"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(["require", "exports"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Trampoline = (function () { |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol", "./Symbol", "./Util", "./BigInt/BigNat", "./BigInt/BigNat", "./Seq", "./Long", "./String"], factory); | ||
} | ||
})(["require", "exports", "./Symbol", "./Symbol", "./Util", "./BigInt/BigNat", "./BigInt/BigNat", "./Seq", "./Long", "./String"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("./Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "../Symbol", "../Symbol", "../Util", "../Long", "../Seq", "./FFT", "../List", "../String"], factory); | ||
} | ||
})(["require", "exports", "../Symbol", "../Symbol", "../Util", "../Long", "../Seq", "./FFT", "../List", "../String"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("../Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "../Long", "../Seq"], factory); | ||
} | ||
})(["require", "exports", "../Long", "../Seq"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Long_1 = require("../Long"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Long"], factory); | ||
} | ||
})(["require", "exports", "./Long"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Long = require("./Long"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol", "./Util", "./Util"], factory); | ||
} | ||
})(["require", "exports", "./Symbol", "./Util", "./Util"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("./Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./TimeSpan", "./Util", "./Long"], factory); | ||
} | ||
})(["require", "exports", "./TimeSpan", "./Util", "./Long"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var TimeSpan_1 = require("./TimeSpan"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Seq", "./Observable", "./Observable"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Seq", "./Observable", "./Observable"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(["require", "exports"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ function createFromValue(v) { |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./ListClass", "./Seq", "./Seq", "./Seq", "./Seq", "./Map", "./ListClass"], factory); | ||
} | ||
})(["require", "exports", "./ListClass", "./Seq", "./Seq", "./Seq", "./Seq", "./Map", "./ListClass"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var ListClass_1 = require("./ListClass"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol", "./Util", "./Util", "./Util"], factory); | ||
} | ||
})(["require", "exports", "./Symbol", "./Util", "./Util", "./Util"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("./Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("./Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Async", "./Async", "./Async"], factory); | ||
} | ||
})(["require", "exports", "./Async", "./Async", "./Async"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Async_1 = require("./Async"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./ListClass", "./ListClass", "./Util", "./Util", "./Util", "./GenericComparer", "./Symbol", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq"], factory); | ||
} | ||
})(["require", "exports", "./ListClass", "./ListClass", "./Util", "./Util", "./Util", "./GenericComparer", "./Symbol", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var ListClass_1 = require("./ListClass"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./List", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./List", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -13,2 +14,17 @@ var Util_1 = require("./Util"); | ||
var Symbol_1 = require("./Symbol"); | ||
var MemberInfo = (function () { | ||
function MemberInfo(name, index, declaringType, propertyType, unionFields) { | ||
this.name = name; | ||
this.index = index; | ||
this.declaringType = declaringType; | ||
this.propertyType = propertyType; | ||
this.unionFields = unionFields; | ||
} | ||
MemberInfo.prototype.getUnionFields = function () { | ||
var _this = this; | ||
return this.unionFields.map(function (fi, i) { return new MemberInfo("unknown", i, _this.declaringType, fi); }); | ||
}; | ||
return MemberInfo; | ||
}()); | ||
exports.MemberInfo = MemberInfo; | ||
function resolveGeneric(idx, enclosing) { | ||
@@ -84,2 +100,4 @@ try { | ||
return typ.definition; | ||
case "GenericType": | ||
return getTypeFullName(typ.definition, option); | ||
case "Any": | ||
@@ -97,2 +115,87 @@ default: | ||
exports.getTypeFullName = getTypeFullName; | ||
function getName(x) { | ||
if (x instanceof MemberInfo) { | ||
return x.name; | ||
} | ||
return getTypeFullName(x, "name"); | ||
} | ||
exports.getName = getName; | ||
function getPrototypeOfType(typ) { | ||
if (typeof typ === "string") { | ||
return null; | ||
} | ||
else if (typ instanceof Util_1.NonDeclaredType) { | ||
return typ.kind === "GenericType" ? typ.definition.prototype : null; | ||
} | ||
else { | ||
return typ.prototype; | ||
} | ||
} | ||
exports.getPrototypeOfType = getPrototypeOfType; | ||
function getProperties(typ) { | ||
var proto = getPrototypeOfType(typ); | ||
if (proto != null && typeof proto[Symbol_1.default.reflection] === "function") { | ||
var info_1 = proto[Symbol_1.default.reflection](); | ||
if (info_1.properties) { | ||
return Object.getOwnPropertyNames(info_1.properties) | ||
.map(function (k, i) { return new MemberInfo(k, i, typ, info_1.properties[k]); }); | ||
} | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " doesn't contain property info."); | ||
} | ||
exports.getProperties = getProperties; | ||
function getUnionCases(typ) { | ||
var proto = getPrototypeOfType(typ); | ||
if (proto != null && typeof proto[Symbol_1.default.reflection] === "function") { | ||
var info_2 = proto[Symbol_1.default.reflection](); | ||
if (info_2.cases) { | ||
return Object.getOwnPropertyNames(info_2.cases) | ||
.map(function (k, i) { return new MemberInfo(k, i, typ, null, info_2.cases[k]); }); | ||
} | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " doesn't contain union case info."); | ||
} | ||
exports.getUnionCases = getUnionCases; | ||
function getPropertyValues(obj) { | ||
return Util_1.getPropertyNames(obj).map(function (k) { return obj[k]; }); | ||
} | ||
exports.getPropertyValues = getPropertyValues; | ||
function getUnionFields(obj, typ) { | ||
if (obj != null && typeof obj[Symbol_1.default.reflection] === "function") { | ||
var info = obj[Symbol_1.default.reflection](); | ||
if (info.cases) { | ||
var uci = null, cases = Object.getOwnPropertyNames(info.cases); | ||
for (var i = 0; i < cases.length; i++) { | ||
if (cases[i] === obj.Case) { | ||
uci = new MemberInfo(cases[i], i, typ, null, info.cases[cases[i]]); | ||
break; | ||
} | ||
} | ||
if (uci != null) { | ||
return [uci, obj.Fields]; | ||
} | ||
} | ||
} | ||
throw new Error("Not an F# union type."); | ||
} | ||
exports.getUnionFields = getUnionFields; | ||
function makeUnion(caseInfo, args) { | ||
var Cons = Util_1.getDefinition(caseInfo.declaringType); | ||
return new (Cons.bind.apply(Cons, [void 0, caseInfo.name].concat(args)))(); | ||
} | ||
exports.makeUnion = makeUnion; | ||
function getTupleElements(typ) { | ||
if (typ instanceof Util_1.NonDeclaredType && typ.kind === "Tuple") { | ||
return typ.generics; | ||
} | ||
throw new Error("Type " + getTypeFullName(typ) + " is not a tuple type."); | ||
} | ||
exports.getTupleElements = getTupleElements; | ||
function isTupleType(typ) { | ||
if (typ instanceof Util_1.NonDeclaredType) { | ||
return typ.kind === "Tuple"; | ||
} | ||
return false; | ||
} | ||
exports.isTupleType = isTupleType; | ||
}); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(["require", "exports"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ function create(pattern, options) { |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Util", "./Array", "./ListClass"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Util", "./Array", "./ListClass"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol", "./Symbol", "./List", "./List", "./Set", "./Map", "./Map", "./Set", "./Util", "./Util", "./Util", "./Seq", "./Reflection", "./Date", "./String"], factory); | ||
} | ||
})(["require", "exports", "./Symbol", "./Symbol", "./List", "./List", "./Set", "./Map", "./Map", "./Set", "./Util", "./Util", "./Util", "./Seq", "./Reflection", "./Date", "./String"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Symbol_1 = require("./Symbol"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./List", "./List", "./Util", "./GenericComparer", "./Symbol", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq"], factory); | ||
} | ||
})(["require", "exports", "./List", "./List", "./Util", "./GenericComparer", "./Symbol", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq", "./Seq"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var List_1 = require("./List"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Util", "./RegExp", "./Date", "./Date", "./Date", "./Date", "./Date", "./Date"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Util", "./RegExp", "./Date", "./Date", "./Date", "./Date", "./Date", "./Date"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
} | ||
})(["require", "exports"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var fableGlobal = function () { |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Event", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Event", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Event_1 = require("./Event"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Util", "./Long"], factory); | ||
} | ||
})(["require", "exports", "./Util", "./Long"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -10,0 +11,0 @@ var Util_1 = require("./Util"); |
@@ -1,9 +0,10 @@ | ||
(function (dependencies, factory) { | ||
if (typeof module === 'object' && typeof module.exports === 'object') { | ||
var v = factory(require, exports); if (v !== undefined) module.exports = v; | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === 'function' && define.amd) { | ||
define(dependencies, factory); | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Symbol"], factory); | ||
} | ||
})(["require", "exports", "./Symbol"], function (require, exports) { | ||
})(function (require, exports) { | ||
"use strict"; | ||
@@ -63,3 +64,3 @@ var Symbol_1 = require("./Symbol"); | ||
function isGeneric(typ) { | ||
return typ instanceof NonDeclaredType && typ.generics != null; | ||
return typ instanceof NonDeclaredType && typ.kind === "GenericType"; | ||
} | ||
@@ -106,3 +107,3 @@ exports.isGeneric = isGeneric; | ||
} | ||
var propertyMap = typeof obj[Symbol_1.default.reflection] === "function" ? obj[Symbol_1.default.reflection]().properties : obj; | ||
var propertyMap = typeof obj[Symbol_1.default.reflection] === "function" ? obj[Symbol_1.default.reflection]().properties || [] : obj; | ||
return Object.getOwnPropertyNames(propertyMap); | ||
@@ -109,0 +110,0 @@ } |
@@ -49,3 +49,3 @@ import FSymbol from "./Symbol"; | ||
export function isGeneric(typ) { | ||
return typ instanceof NonDeclaredType && typ.generics != null; | ||
return typ instanceof NonDeclaredType && typ.kind === "GenericType"; | ||
} | ||
@@ -88,3 +88,3 @@ export function getDefinition(typ) { | ||
} | ||
var propertyMap = typeof obj[FSymbol.reflection] === "function" ? obj[FSymbol.reflection]().properties : obj; | ||
var propertyMap = typeof obj[FSymbol.reflection] === "function" ? obj[FSymbol.reflection]().properties || [] : obj; | ||
return Object.getOwnPropertyNames(propertyMap); | ||
@@ -91,0 +91,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4706499
15883