type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
FunctionDeclaration
/** * Create a new immutable Set containing the values of the provided * collection-like. * * Note: `Set` is a factory function and not a class, and does not use the * `new` keyword during construction. */ export function Set(): Set<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Set<T>(): Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Set<T>(collection: Iterable<T>): Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if the provided value is a `SortedSet`. * * ```js * > const { SortedMap, SortedSet, List, Map, Set } = require('immutable-sorted'); * > SortedSet.isSortedSet(SortedSet()); * true * > SortedSet.isSortedSet(SortedMap()); * false * > SortedSet.isSortedSet(Set()); * false * > SortedSet.isSortedSet(Map()); * false * > SortedSet.isSortedSet(List()); * false * ``` */ function isSortedSet(maybeSortedSet: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a new `SortedSet` containing `values`. * * ```js * > const { SortedMap } = require('immutable-sorted'); * > let sortedSet=SortedSet.of("orange", "apple", "banana"); * SortedSet { "apple", "banana", "orange" } * ``` */ function of<T>(...values: Array<T>): SortedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * `SortedSet.fromKeys()` creates a new immutable `SortedSet` containing * the keys from this Collection or JavaScript Object. * * ```js * > const { SortedMap, Map } = require('immutable-sorted'); * * > let map=Map({x:'X', c:'B', m:'M', anylabel:'K', f:'F'}); * > let sortedSet=SortedSet.fromKeys(map); * SortedSet { "anylabel", "c", "f", "m", "x" } * * > sortedSet=SortedSet.fromKeys({x:'X', c:'B', m:'M', anylabel:'K', f:'F'}); * SortedSet { "anylabel", "c", "f", "m", "x" } * ``` */ function fromKeys<T>(iter: Collection<T, any>): SortedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
function fromKeys(obj: {[key: string]: any}): SortedSet<string>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a new immutable `SortedSet` containing the values of the provided * collection-like. The values will be sorted by the provided comparator. * * The comparator is a function that takes two arguments (a, b) and * returns 0 if a and b are equal, returns positive number when a > b * and returns negative number if a < b. * * If comparator is undefined, the `defaultComparator` will be applied. * This comparator is different than the default comparator used by `Collection.sort` * because more stringent comparison rules have to be applied to support all the types * and marginal values like NaN or Infinity. * * The `defaultComparator` first determines equality by calling `Immutable.is`, * then compares the types of both values. If both values are of the same type, * then it compares the values by using the javascript comparison operators > and <, * but before that the objects, functions, and symbols are converted to string. * * The internal data structures will be created according to the given options. If options * are undefined then `defaultOptions` will be applied. * * The default options are: * ```js * {type: 'btree', btreeOrder: 33} * ``` * Currently the only type implemented is `btree`. It is a classic [B-Tree](https://en.wikipedia.org/wiki/B-tree) * structure with keys and values not only in leaves but also in internal nodes. * The option `btreeOrder` is defined as the maximum number of children that any internal nodes can have * and also implies maximum number of entries (key/value pairs) in any node which is (`btreeOrder` - 1). * The `btreeOrder` option can be changed in a constructor and can be any integer greater or equal 3. * * There are many ways to quickly and conveniently create a `SortedSet` by calling a constructor. * Below are some examples. * * Create a `SortedSet` from any array: * ```js * > const { SortedMap } = require('immutable-sorted'); * > let a=SortedSet(['a', 'c', 'z', 'u', 'b', 'q', 'd']); * SortedSet { "a", "b", "c", "d", "q", "u", "z" } * ``` * * From a sequence of values: * ```js * > const { SortedMap, SortedSet, List, Map, Seq, Set } = require('immutable-sorted'); * * > let seq=Seq({x:'X', c:'B', m:'M', anylabel:'K', f:'F'}); * Seq { "x": "X", "c": "B", "m": "M", "anylabel": "K", "f": "F" } * * > let b=SortedSet(seq.keySeq()); * SortedSet { "anylabel", "c", "f", "m", "x" } * * > let c=SortedSet(seq.valueSeq()); * SortedSet { "B", "F", "K", "M", "X" } * ``` * * From a string: * ```js * > let d=SortedSet('abcdefg'); * SortedSet { "a", "b", "c", "d", "e", "f", "g" } * * > let e=SortedSet('gefdcba'); * SortedSet { "a", "b", "c", "d", "e", "f", "g" } * * > e=SortedSet("hello"); * SortedSet { "e", "h", "l", "o" } * ``` * * From other collections (List, Range, Set, Map): * ```js * > let list=List(['orange', 'apple', 'banana']); * List [ "orange", "apple", "banana" ] * > let f=SortedSet(list); * SortedSet { "apple", "banana", "orange" } * * > let range=Range(30, 0, 5); * Range [ 30...0 by -5 ] * > f=SortedSet(range); * SortedSet { 5, 10, 15, 20, 25, 30 } * * > let set=Set(['orange', 'apple', 'banana']); * Set { "orange", "apple", "banana" } * > f=SortedSet(set); * SortedSet { "apple", "banana", "orange" } * * > let map=Map({x:'X', c:'B', m:'M', anylabel:'K', f:'F'}); * Map { "x": "X", "c": "B", "m": "M", "anylabel": "K", "f": "F" } * > f=SortedSet(map.keySeq()); * SortedSet { "anylabel", "c", "f", "m", "x" } * ``` * * Use a custom comparator (reverse order): * ```js * > let reverseComparator=(a, b)=>(a > b ? -1 : a < b ? 1 : 0); * > let g=SortedSet(list, reverseComparator); * SortedSet { "orange", "banana", "apple" } * * // Create an empty set with custom comparator * > g=SortedSet(undefined, reverseComparator); * ``` * * Change the `btreeOrder` option: * ```js * > let options={type: 'btree', btreeOrder: 17}; * > let h=SortedSet(list, reverseComparator, options); * SortedSet { "orange", "banana", "apple" } * * // Create an empty set with default comparator and custom options * > h=SortedSet(undefined, undefined, options); * ``` * * You can also conveniently create a `SortedSet` within a chain of sequence operations: * ```js * > seq.keySeq().toSortedSet(); * SortedSet { "anylabel", "c", "f", "m", "x" } * * > seq.valueSeq().toSortedSet(); * SortedSet { "B", "F", "K", "M", "X" } * * > seq.valueSeq().toSortedSet(reverseComparator); * SortedSet { "X", "M", "K", "F", "B" } * ``` */ export function SortedSet<T>(collection?: Iterable<T>, comparator?: (a: T, b: T) => number, options?: Object): SortedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if the provided value is an OrderedSet. */ function isOrderedSet(maybeOrderedSet: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a new OrderedSet containing `values`. */ function of<T>(...values: Array<T>): OrderedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing * the keys from this Collection or JavaScript Object. */ function fromKeys<T>(iter: Collection<T, any>): OrderedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
function fromKeys(obj: {[key: string]: any}): OrderedSet<string>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Create a new immutable OrderedSet containing the values of the provided * collection-like. * * Note: `OrderedSet` is a factory function and not a class, and does not use * the `new` keyword during construction. */ export function OrderedSet(): OrderedSet<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function OrderedSet<T>(): OrderedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function OrderedSet<T>(collection: Iterable<T>): OrderedSet<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if the provided value is a Stack */ function isStack(maybeStack: any): maybeStack is Stack<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a new Stack containing `values`. */ function of<T>(...values: Array<T>): Stack<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Create a new immutable Stack containing the values of the provided * collection-like. * * The iteration order of the provided collection is preserved in the * resulting `Stack`. * * Note: `Stack` is a factory function and not a class, and does not use the * `new` keyword during construction. */ export function Stack(): Stack<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Stack<T>(): Stack<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Stack<T>(collection: Iterable<T>): Stack<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to * infinity. When `start` is equal to `end`, returns empty range. * * Note: `Range` is a factory function and not a class, and does not use the * `new` keyword during construction. * * ```js * const { Range } = require('immutable') * Range() // [ 0, 1, 2, 3, ... ] * Range(10) // [ 10, 11, 12, 13, ... ] * Range(10, 15) // [ 10, 11, 12, 13, 14 ] * Range(10, 30, 5) // [ 10, 15, 20, 25 ] * Range(30, 10, 5) // [ 30, 25, 20, 15 ] * Range(30, 30, 5) // [] * ``` */ export function Range(start?: number, end?: number, step?: number): Seq.Indexed<number>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is * not defined, returns an infinite `Seq` of `value`. * * Note: `Repeat` is a factory function and not a class, and does not use the * `new` keyword during construction. * * ```js * const { Repeat } = require('immutable') * Repeat('foo') // [ 'foo', 'foo', 'foo', ... ] * Repeat('bar', 4) // [ 'bar', 'bar', 'bar', 'bar' ] * ``` */ export function Repeat<T>(value: T, times?: number): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeRecord` is an instance of a Record. */ export function isRecord(maybeRecord: any): maybeRecord is Record<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Records allow passing a second parameter to supply a descriptive name * that appears when converting a Record to a string or in any error * messages. A descriptive name for any record can be accessed by using this * method. If one was not provided, the string "Record" is returned. * * ```js * const { Record } = require('immutable') * const Person = Record({ * name: null * }, 'Person') * * var me = Person({ name: 'My Name' }) * me.toString() // "Person { "name": "My Name" }" * Record.getDescriptiveName(me) // "Person" * ``` */ export function getDescriptiveName(record: Record<any>): string;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Factory<TProps extends Object>(values?: Partial<TProps> | Iterable<[string, any]>): Record<TProps> & Readonly<TProps>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Unlike other types in Immutable.js, the `Record()` function creates a new * Record Factory, which is a function that creates Record instances. * * See above for examples of using `Record()`. * * Note: `Record` is a factory function and not a class, and does not use the * `new` keyword during construction. */ export function Record<TProps>(defaultValues: TProps, name?: string): Record.Factory<TProps>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSeq` is a Seq, it is not backed by a concrete * structure such as Map, List, or Set. */ function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Always returns a Seq.Keyed, if input is not keyed, expects an * collection of [K, V] tuples. * * Note: `Seq.Keyed` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ export function Keyed<K, V>(collection: Iterable<[K, V]>): Seq.Keyed<K, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Keyed<V>(obj: {[key: string]: V}): Seq.Keyed<string, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Keyed<K, V>(): Seq.Keyed<K, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Keyed(): Seq.Keyed<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Provides an Seq.Indexed of the values provided. */ function of<T>(...values: Array<T>): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Always returns Seq.Indexed, discarding associated keys and * supplying incrementing indices. * * Note: `Seq.Indexed` is a conversion function and not a class, and does * not use the `new` keyword during construction. */ export function Indexed(): Seq.Indexed<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Indexed<T>(): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Indexed<T>(collection: Iterable<T>): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a Seq.Set of the provided values */ function of<T>(...values: Array<T>): Seq.Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Always returns a Seq.Set, discarding associated indices or keys. * * Note: `Seq.Set` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ export function Set(): Seq.Set<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Set<T>(): Seq.Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Set<T>(collection: Iterable<T>): Seq.Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a Seq. * * Returns a particular kind of `Seq` based on the input. * * * If a `Seq`, that same `Seq`. * * If an `Collection`, a `Seq` of the same kind (Keyed, Indexed, or Set). * * If an Array-like, an `Seq.Indexed`. * * If an Iterable Object, an `Seq.Indexed`. * * If an Object, a `Seq.Keyed`. * * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, * which is usually not what you want. You should turn your Iterator Object into * an iterable object by defining a Symbol.iterator (or @@iterator) method which * returns `this`. * * Note: `Seq` is a conversion function and not a class, and does not use the * `new` keyword during construction. */ export function Seq<S extends Seq<any, any>>(seq: S): S;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq<K, V>(collection: Collection.Keyed<K, V>): Seq.Keyed<K, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq<T>(collection: Collection.Indexed<T>): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq<T>(collection: Collection.Set<T>): Seq.Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq<T>(collection: Iterable<T>): Seq.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq<V>(obj: {[key: string]: V}): Seq.Keyed<string, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Seq(): Seq<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * @deprecated use `const { isKeyed } = require('immutable')` */ function isKeyed(maybeKeyed: any): maybeKeyed is Collection.Keyed<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * @deprecated use `const { isIndexed } = require('immutable')` */ function isIndexed(maybeIndexed: any): maybeIndexed is Collection.Indexed<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * @deprecated use `const { isAssociative } = require('immutable')` */ function isAssociative(maybeAssociative: any): maybeAssociative is Collection.Keyed<any, any> | Collection.Indexed<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * @deprecated use `const { isOrdered } = require('immutable')` */ function isOrdered(maybeOrdered: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a Collection.Keyed * * Similar to `Collection()`, however it expects collection-likes of [K, V] * tuples if not constructed from a Collection.Keyed or JS Object. * * Note: `Collection.Keyed` is a conversion function and not a class, and * does not use the `new` keyword during construction. */ export function Keyed<K, V>(collection: Iterable<[K, V]>): Collection.Keyed<K, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Keyed<V>(obj: {[key: string]: V}): Collection.Keyed<string, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a new Collection.Indexed. * * Note: `Collection.Indexed` is a conversion function and not a class, and * does not use the `new` keyword during construction. */ export function Indexed<T>(collection: Iterable<T>): Collection.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Similar to `Collection()`, but always returns a Collection.Set. * * Note: `Collection.Set` is a factory function and not a class, and does * not use the `new` keyword during construction. */ export function Set<T>(collection: Iterable<T>): Collection.Set<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Creates a Collection. * * The type of Collection created is based on the input. * * * If an `Collection`, that same `Collection`. * * If an Array-like, an `Collection.Indexed`. * * If an Object with an Iterator defined, an `Collection.Indexed`. * * If an Object, an `Collection.Keyed`. * * This methods forces the conversion of Objects and Strings to Collections. * If you want to ensure that a Collection of one item is returned, use * `Seq.of`. * * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, * which is usually not what you want. You should turn your Iterator Object into * an iterable object by defining a Symbol.iterator (or @@iterator) method which * returns `this`. * * Note: `Collection` is a conversion function and not a class, and does not * use the `new` keyword during construction. */ export function Collection<I extends Collection<any, any>>(collection: I): I;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Collection<T>(collection: Iterable<T>): Collection.Indexed<T>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function Collection<V>(obj: {[key: string]: V}): Collection.Keyed<string, V>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. * * If a `reviver` is optionally provided, it will be called with every * collection as a Seq (beginning with the most nested collections * and proceeding to the top-level collection itself), along with the key * referring to each collection and the parent JS object provided as `this`. * For the top level, object, the key will be `""`. This `reviver` is expected * to return a new Immutable Collection, allowing for custom conversions from * deep JS objects. Finally, a `path` is provided which is the sequence of * keys to this value from the starting value. * * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. * * If `reviver` is not provided, the default behavior will convert Objects * into Maps and Arrays into Lists like so: * * <!-- runkit:activate --> * ```js * const { fromJS, isKeyed } = require('immutable') * function (key, value) { * return isKeyed(value) ? value.toMap() : value.toList() * } * ``` * * `fromJS` is conservative in its conversion. It will only convert * arrays which pass `Array.isArray` to Lists, and only raw objects (no custom * prototype) to Map. * * Accordingly, this example converts native JS data to OrderedMap and List: * * <!-- runkit:activate --> * ```js * const { fromJS, isKeyed } = require('immutable') * fromJS({ a: {b: [10, 20, 30]}, c: 40}, function (key, value, path) { * console.log(key, value, path) * return isKeyed(value) ? value.toOrderedMap() : value.toList() * }) * * > "b", [ 10, 20, 30 ], [ "a", "b" ] * > "a", {b: [10, 20, 30]}, [ "a" ] * > "", {a: {b: [10, 20, 30]}, c: 40}, [] * ``` * * Keep in mind, when using JS objects to construct Immutable Maps, that * JavaScript Object properties are always strings, even if written in a * quote-less shorthand, while Immutable Maps accept keys of any type. * * <!-- runkit:activate --> * ```js * const { Map } = require('immutable') * let obj = { 1: "one" }; * Object.keys(obj); // [ "1" ] * assert.equal(obj["1"], obj[1]); // "one" === "one" * * let map = Map(obj); * assert.notEqual(map.get("1"), map.get(1)); // "one" !== undefined * ``` * * Property access for JavaScript Objects first converts the key to a string, * but since Immutable Map keys can be of any type the argument to `get()` is * not altered. * * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter * "Using the reviver parameter" */ export function fromJS( jsValue: any, reviver?: ( key: string | number, sequence: Collection.Keyed<string, any> | Collection.Indexed<any>, path?: Array<string | number> ) => any ): any;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Value equality check with semantics similar to `Object.is`, but treats * Immutable `Collection`s as values, equal if the second `Collection` includes * equivalent values. * * It's used throughout Immutable when checking for equality, including `Map` * key equality and `Set` membership. * * <!-- runkit:activate --> * ```js * const { Map, is } = require('immutable') * const map1 = Map({ a: 1, b: 1, c: 1 }) * const map2 = Map({ a: 1, b: 1, c: 1 }) * assert.equal(map1 !== map2, true) * assert.equal(Object.is(map1, map2), false) * assert.equal(is(map1, map2), true) * ``` * * `is()` compares primitive types like strings and numbers, Immutable.js * collections like `Map` and `List`, but also any custom object which * implements `ValueObject` by providing `equals()` and `hashCode()` methods. * * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same * value, matching the behavior of ES6 Map key equality. */ export function is(first: any, second: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * The `hash()` function is an important part of how Immutable determines if * two values are equivalent and is used to determine how to store those * values. Provided with any value, `hash()` will return a 31-bit integer. * * When designing Objects which may be equal, it's important that when a * `.equals()` method returns true, that both values `.hashCode()` method * return the same value. `hash()` may be used to produce those values. * * For non-Immutable Objects that do not provide a `.hashCode()` functions * (including plain Objects, plain Arrays, Date objects, etc), a unique hash * value will be created for each *instance*. That is, the create hash * represents referential equality, and not value equality for Objects. This * ensures that if that Object is mutated over time that its hash code will * remain consistent, allowing Objects to be used as keys and values in * Immutable.js collections. * * Note that `hash()` attempts to balance between speed and avoiding * collisions, however it makes no attempt to produce secure hashes. * * *New in Version 4.0* */ export function hash(value: any): number;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeImmutable` is an Immutable Collection or Record. * * Note: Still returns true even if the collections is within a `withMutations()`. * * <!-- runkit:activate --> * ```js * const { isImmutable, Map, List, Stack } = require('immutable'); * isImmutable([]); // false * isImmutable({}); // false * isImmutable(Map()); // true * isImmutable(List()); // true * isImmutable(Stack()); // true * isImmutable(Map().asMutable()); // true * ``` */ export function isImmutable(maybeImmutable: any): maybeImmutable is Collection<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeCollection` is a Collection, or any of its subclasses. * * <!-- runkit:activate --> * ```js * const { isCollection, Map, List, Stack } = require('immutable'); * isCollection([]); // false * isCollection({}); // false * isCollection(Map()); // true * isCollection(List()); // true * isCollection(Stack()); // true * ``` */ export function isCollection(maybeCollection: any): maybeCollection is Collection<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeKeyed` is a Collection.Keyed, or any of its subclasses. * * <!-- runkit:activate --> * ```js * const { isKeyed, Map, List, Stack } = require('immutable'); * isKeyed([]); // false * isKeyed({}); // false * isKeyed(Map()); // true * isKeyed(List()); // false * isKeyed(Stack()); // false * ``` */ export function isKeyed(maybeKeyed: any): maybeKeyed is Collection.Keyed<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeIndexed` is a Collection.Indexed, or any of its subclasses. * * <!-- runkit:activate --> * ```js * const { isIndexed, Map, List, Stack, Set } = require('immutable'); * isIndexed([]); // false * isIndexed({}); // false * isIndexed(Map()); // false * isIndexed(List()); // true * isIndexed(Stack()); // true * isIndexed(Set()); // false * ``` */ export function isIndexed(maybeIndexed: any): maybeIndexed is Collection.Indexed<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeAssociative` is either a Keyed or Indexed Collection. * * <!-- runkit:activate --> * ```js * const { isAssociative, Map, List, Stack, Set } = require('immutable'); * isAssociative([]); // false * isAssociative({}); // false * isAssociative(Map()); // true * isAssociative(List()); // true * isAssociative(Stack()); // true * isAssociative(Set()); // false * ``` */ export function isAssociative(maybeAssociative: any): maybeAssociative is Collection.Keyed<any, any> | Collection.Indexed<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeOrdered` is a Collection where iteration order is well * defined. True for Collection.Indexed as well as OrderedMap and OrderedSet. * * <!-- runkit:activate --> * ```js * const { isOrdered, Map, OrderedMap, List, Set } = require('immutable'); * isOrdered([]); // false * isOrdered({}); // false * isOrdered(Map()); // false * isOrdered(OrderedMap()); // true * isOrdered(List()); // true * isOrdered(Set()); // false * ``` */ export function isOrdered(maybeOrdered: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSorted` is a Collection where iteration order is well * defined by a comparator. * * <!-- runkit:activate --> * ```js * const { isSorted, Map, SortedMap, List, Set } = require('immutable'); * isSorted([]); // false * isSorted({}); // false * isSorted(Map()); // false * isSorted(SortedMap()); // true * isSorted(List()); // true * isSorted(Set()); // false * ``` */ export function isSorted(maybeSorted: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeValue` is a JavaScript Object which has *both* `equals()` * and `hashCode()` methods. * * Any two instances of *value objects* can be compared for value equality with * `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`. */ export function isValueObject(maybeValue: any): maybeValue is ValueObject;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSeq` is a Seq. */ export function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeList` is a List. */ export function isList(maybeList: any): maybeList is List<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeMap` is a Map. * * Also true for OrderedMaps and SortedMaps. */ export function isMap(maybeMap: any): maybeMap is Map<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeOrderedMap` is an OrderedMap. */ export function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSortedMap` is an SortedMap. */ export function isSortedMap(maybeSortedMap: any): maybeSortedMap is SortedMap<any, any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeStack` is a Stack. */ export function isStack(maybeStack: any): maybeStack is Stack<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSet` is a Set. * * Also true for OrderedSets and SortedSets. */ export function isSet(maybeSet: any): maybeSet is Set<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeOrderedSet` is an OrderedSet. */ export function isOrderedSet(maybeOrderedSet: any): maybeOrderedSet is OrderedSet<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeSortedSet` is an SortedSet. */ export function isSortedSet(maybeSortedSet: any): maybeSortedSet is SortedSet<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * True if `maybeRecord` is a Record. */ export function isRecord(maybeRecord: any): maybeRecord is Record<any>;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns the value within the provided collection associated with the * provided key, or notSetValue if the key is not defined in the collection. * * A functional alternative to `collection.get(key)` which will also work on * plain Objects and Arrays as an alternative for `collection[key]`. * * <!-- runkit:activate --> * ```js * const { get } = require('immutable') * get([ 'dog', 'frog', 'cat' ], 2) // 'frog' * get({ x: 123, y: 456 }, 'x') // 123 * get({ x: 123, y: 456 }, 'z', 'ifNotSet') // 'ifNotSet' * ``` */ export function get<K, V>(collection: Collection<K, V>, key: K): V | undefined;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<K, V, NSV>(collection: Collection<K, V>, key: K, notSetValue: NSV): V | NSV;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<TProps, K extends keyof TProps>(record: Record<TProps>, key: K, notSetValue: any): TProps[K];
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<V>(collection: Array<V>, key: number): V | undefined;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<V, NSV>(collection: Array<V>, key: number, notSetValue: NSV): V | NSV;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<C extends Object, K extends keyof C>(object: C, key: K, notSetValue: any): C[K];
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<V>(collection: {[key: string]: V}, key: string): V | undefined;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function get<V, NSV>(collection: {[key: string]: V}, key: string, notSetValue: NSV): V | NSV;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns true if the key is defined in the provided collection. * * A functional alternative to `collection.has(key)` which will also work with * plain Objects and Arrays as an alternative for * `collection.hasOwnProperty(key)`. * * <!-- runkit:activate --> * ```js * const { has } = require('immutable') * has([ 'dog', 'frog', 'cat' ], 2) // true * has([ 'dog', 'frog', 'cat' ], 5) // false * has({ x: 123, y: 456 }, 'x') // true * has({ x: 123, y: 456 }, 'z') // false * ``` */ export function has(collection: Object, key: any): boolean;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a copy of the collection with the value at key removed. * * A functional alternative to `collection.remove(key)` which will also work * with plain Objects and Arrays as an alternative for * `delete collectionCopy[key]`. * * <!-- runkit:activate --> * ```js * const { remove } = require('immutable') * const originalArray = [ 'dog', 'frog', 'cat' ] * remove(originalArray, 1) // [ 'dog', 'cat' ] * console.log(originalArray) // [ 'dog', 'frog', 'cat' ] * const originalObject = { x: 123, y: 456 } * remove(originalObject, 'x') // { y: 456 } * console.log(originalObject) // { x: 123, y: 456 } * ``` */ export function remove<K, C extends Collection<K, any>>(collection: C, key: K): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function remove<TProps, C extends Record<TProps>, K extends keyof TProps>(collection: C, key: K): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function remove<C extends Array<any>>(collection: C, key: number): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function remove<C, K extends keyof C>(collection: C, key: K): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function remove<C extends {[key: string]: any}, K extends keyof C>(collection: C, key: K): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a copy of the collection with the value at key set to the provided * value. * * A functional alternative to `collection.set(key, value)` which will also * work with plain Objects and Arrays as an alternative for * `collectionCopy[key] = value`. * * <!-- runkit:activate --> * ```js * const { set } = require('immutable') * const originalArray = [ 'dog', 'frog', 'cat' ] * set(originalArray, 1, 'cow') // [ 'dog', 'cow', 'cat' ] * console.log(originalArray) // [ 'dog', 'frog', 'cat' ] * const originalObject = { x: 123, y: 456 } * set(originalObject, 'x', 789) // { x: 789, y: 456 } * console.log(originalObject) // { x: 123, y: 456 } * ``` */ export function set<K, V, C extends Collection<K, V>>(collection: C, key: K, value: V): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function set<TProps, C extends Record<TProps>, K extends keyof TProps>(record: C, key: K, value: TProps[K]): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function set<V, C extends Array<V>>(collection: C, key: number, value: V): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function set<C, K extends keyof C>(object: C, key: K, value: C[K]): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function set<V, C extends {[key: string]: V}>(collection: C, key: string, value: V): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
/** * Returns a copy of the collection with the value at key set to the result of * providing the existing value to the updating function. * * A functional alternative to `collection.update(key, fn)` which will also * work with plain Objects and Arrays as an alternative for * `collectionCopy[key] = fn(collection[key])`. * * <!-- runkit:activate --> * ```js * const { update } = require('immutable') * const originalArray = [ 'dog', 'frog', 'cat' ] * update(originalArray, 1, val => val.toUpperCase()) // [ 'dog', 'FROG', 'cat' ] * console.log(originalArray) // [ 'dog', 'frog', 'cat' ] * const originalObject = { x: 123, y: 456 } * update(originalObject, 'x', val => val * 6) // { x: 738, y: 456 } * console.log(originalObject) // { x: 123, y: 456 } * ``` */ export function update<K, V, C extends Collection<K, V>>(collection: C, key: K, updater: (value: V) => V): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function update<K, V, C extends Collection<K, V>, NSV>(collection: C, key: K, notSetValue: NSV, updater: (value: V | NSV) => V): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript
FunctionDeclaration
export function update<TProps, C extends Record<TProps>, K extends keyof TProps>(record: C, key: K, updater: (value: TProps[K]) => TProps[K]): C;
applitopia/immutable-sorted
type-definitions/Immutable.d.ts
TypeScript