fable-core
Advanced tools
Comparing version 0.7.18 to 0.7.19
@@ -10,1 +10,3 @@ export declare function addRangeInPlace<T>(range: Iterable<T>, xs: Array<T>): void; | ||
export declare function unzip3<T1, T2, T3>(xs: ArrayLike<[T1, T2, T3]>): (T1[] | T2[] | T3[])[]; | ||
export declare function getSubArray<T>(xs: Array<T>, startIndex: number, count: number): T[]; | ||
export declare function fill<T>(target: Array<T>, targetIndex: number, count: number, value: T): void; |
@@ -79,1 +79,7 @@ export function addRangeInPlace(range, xs) { | ||
} | ||
export function getSubArray(xs, startIndex, count) { | ||
return xs.slice(startIndex, startIndex + count); | ||
} | ||
export function fill(target, targetIndex, count, value) { | ||
target.fill(value, targetIndex, targetIndex + count); | ||
} |
{ | ||
"name": "fable-core", | ||
"version": "0.7.18", | ||
"version": "0.7.19", | ||
"description": "Fable core lib & bindings for native JS objects, browser and node APIs", | ||
@@ -5,0 +5,0 @@ "main": "Main.js", |
11
Seq.d.ts
import { IDisposable } from "./Util"; | ||
import List from "./ListClass"; | ||
export declare class Enumerator<T> { | ||
private iter; | ||
private current; | ||
constructor(iter: Iterator<T>); | ||
MoveNext(): boolean; | ||
readonly Current: T; | ||
Reset(): void; | ||
Dispose(): void; | ||
} | ||
export declare function getEnumerator<T>(o: any): Enumerator<T>; | ||
export declare function toIterator<T>(en: Enumerator<T>): Iterator<T>; | ||
export declare function toList<T>(xs: Iterable<T>): List<T>; | ||
@@ -4,0 +15,0 @@ export declare function ofList<T>(xs: List<T>): Iterable<T>; |
38
Seq.js
import { equals } from "./Util"; | ||
import { compare } from "./Util"; | ||
import { compare, hasInterface } from "./Util"; | ||
import { permute as arrayPermute } from "./Array"; | ||
import List from "./ListClass"; | ||
var Enumerator = (function () { | ||
function Enumerator(iter) { | ||
this.iter = iter; | ||
} | ||
Enumerator.prototype.MoveNext = function () { | ||
var cur = this.iter.next(); | ||
this.current = cur.value; | ||
return !cur.done; | ||
}; | ||
Object.defineProperty(Enumerator.prototype, "Current", { | ||
get: function () { | ||
return this.current; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Enumerator.prototype.Reset = function () { | ||
throw new Error("JS iterators cannot be reset"); | ||
}; | ||
Enumerator.prototype.Dispose = function () { }; | ||
return Enumerator; | ||
}()); | ||
export { Enumerator }; | ||
export function getEnumerator(o) { | ||
return hasInterface(o, "System.Collections.Generic.IEnumerable") | ||
? o.GetEnumerator() : new Enumerator(o[Symbol.iterator]()); | ||
} | ||
export function toIterator(en) { | ||
return { | ||
next: function () { | ||
return en.MoveNext() | ||
? { done: false, value: en.Current } | ||
: { done: true, value: null }; | ||
} | ||
}; | ||
} | ||
function __failIfNone(res) { | ||
@@ -6,0 +42,0 @@ if (res == null) |
@@ -97,2 +97,10 @@ (function (dependencies, factory) { | ||
exports.unzip3 = unzip3; | ||
function getSubArray(xs, startIndex, count) { | ||
return xs.slice(startIndex, startIndex + count); | ||
} | ||
exports.getSubArray = getSubArray; | ||
function fill(target, targetIndex, count, value) { | ||
target.fill(value, targetIndex, targetIndex + count); | ||
} | ||
exports.fill = fill; | ||
}); |
@@ -14,2 +14,40 @@ (function (dependencies, factory) { | ||
var ListClass_1 = require("./ListClass"); | ||
var Enumerator = (function () { | ||
function Enumerator(iter) { | ||
this.iter = iter; | ||
} | ||
Enumerator.prototype.MoveNext = function () { | ||
var cur = this.iter.next(); | ||
this.current = cur.value; | ||
return !cur.done; | ||
}; | ||
Object.defineProperty(Enumerator.prototype, "Current", { | ||
get: function () { | ||
return this.current; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Enumerator.prototype.Reset = function () { | ||
throw new Error("JS iterators cannot be reset"); | ||
}; | ||
Enumerator.prototype.Dispose = function () { }; | ||
return Enumerator; | ||
}()); | ||
exports.Enumerator = Enumerator; | ||
function getEnumerator(o) { | ||
return Util_2.hasInterface(o, "System.Collections.Generic.IEnumerable") | ||
? o.GetEnumerator() : new Enumerator(o[Symbol.iterator]()); | ||
} | ||
exports.getEnumerator = getEnumerator; | ||
function toIterator(en) { | ||
return { | ||
next: function () { | ||
return en.MoveNext() | ||
? { done: false, value: en.Current } | ||
: { done: true, value: null }; | ||
} | ||
}; | ||
} | ||
exports.toIterator = toIterator; | ||
function __failIfNone(res) { | ||
@@ -16,0 +54,0 @@ if (res == null) |
@@ -314,2 +314,6 @@ (function (dependencies, factory) { | ||
exports.round = round; | ||
function randomNext(min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min; | ||
} | ||
exports.randomNext = randomNext; | ||
}); |
@@ -56,1 +56,2 @@ export interface IComparer<T> { | ||
export declare function round(value: number, digits?: number): number; | ||
export declare function randomNext(min: number, max: number): number; |
@@ -282,1 +282,4 @@ import FSymbol from "./Symbol"; | ||
} | ||
export function randomNext(min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min; | ||
} |
Sorry, the diff of this file is not supported yet
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
4636152
13294