Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@phosphor/algorithm

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phosphor/algorithm - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

lib/enumerate.d.ts

97

lib/array.d.ts

@@ -380,2 +380,99 @@ /**

/**
* Test whether two arrays are shallowly equal.
*
* @param a - The first array-like object to compare.
*
* @param b - The second array-like object to compare.
*
* @param fn - The comparison function to apply to the elements. It
* should return `true` if the elements are "equal". The default
* compares elements using strict `===` equality.
*
* @returns Whether the two arrays are shallowly equal.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* Modifying the length of the arrays while comparing.
*
* #### Example
* ```typescript
* import { ArrayExt } from '@phosphor/algorithm';
*
* let d1 = [0, 3, 4, 7, 7, 9];
* let d2 = [0, 3, 4, 7, 7, 9];
* let d3 = [42];
* ArrayExt.shallowEqual(d1, d2); // true
* ArrayExt.shallowEqual(d2, d3); // false
* ```
*/
function shallowEqual<T>(a: ArrayLike<T>, b: ArrayLike<T>, fn?: (a: T, b: T) => boolean): boolean;
/**
* Create a slice of an array subject to an optional step.
*
* @param array - The array-like object of interest.
*
* @param options - The options for configuring the slice.
*
* @returns A new array with the specified values.
*
* @throws An exception if the slice `step` is `0`.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `start`, `stop`, or `step` which is non-integral.
*
* #### Example
* ```typescript
* import { ArrayExt } from '@phosphor/algorithm';
*
* let data = [0, 3, 4, 7, 7, 9];
* ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]
* ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]
* ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]
* ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]
* ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]
* ```
*/
function slice<T>(array: ArrayLike<T>, options?: slice.IOptions): T[];
/**
* The namespace for the `slice` function statics.
*/
namespace slice {
/**
* The options for the `slice` function.
*/
interface IOptions {
/**
* The starting index of the slice, inclusive.
*
* Negative values are taken as an offset from the end
* of the array.
*
* The default is `0` if `step > 0` else `n - 1`.
*/
start?: number;
/**
* The stopping index of the slice, exclusive.
*
* Negative values are taken as an offset from the end
* of the array.
*
* The default is `n` if `step > 0` else `-n - 1`.
*/
stop?: number;
/**
* The step value for the slice.
*
* This must not be `0`.
*
* The default is `1`.
*/
step?: number;
}
}
/**
* An array-like object which supports item assignment.

@@ -382,0 +479,0 @@ */

@@ -606,2 +606,134 @@ "use strict";

/**
* Test whether two arrays are shallowly equal.
*
* @param a - The first array-like object to compare.
*
* @param b - The second array-like object to compare.
*
* @param fn - The comparison function to apply to the elements. It
* should return `true` if the elements are "equal". The default
* compares elements using strict `===` equality.
*
* @returns Whether the two arrays are shallowly equal.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* Modifying the length of the arrays while comparing.
*
* #### Example
* ```typescript
* import { ArrayExt } from '@phosphor/algorithm';
*
* let d1 = [0, 3, 4, 7, 7, 9];
* let d2 = [0, 3, 4, 7, 7, 9];
* let d3 = [42];
* ArrayExt.shallowEqual(d1, d2); // true
* ArrayExt.shallowEqual(d2, d3); // false
* ```
*/
function shallowEqual(a, b, fn) {
// Check for object identity first.
if (a === b) {
return true;
}
// Bail early if the lengths are different.
if (a.length !== b.length) {
return false;
}
// Compare each element for equality.
for (var i = 0, n = a.length; i < n; ++i) {
if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {
return false;
}
}
// The array are shallowly equal.
return true;
}
ArrayExt.shallowEqual = shallowEqual;
/**
* Create a slice of an array subject to an optional step.
*
* @param array - The array-like object of interest.
*
* @param options - The options for configuring the slice.
*
* @returns A new array with the specified values.
*
* @throws An exception if the slice `step` is `0`.
*
* #### Complexity
* Linear.
*
* #### Undefined Behavior
* A `start`, `stop`, or `step` which is non-integral.
*
* #### Example
* ```typescript
* import { ArrayExt } from '@phosphor/algorithm';
*
* let data = [0, 3, 4, 7, 7, 9];
* ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]
* ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]
* ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]
* ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]
* ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]
* ```
*/
function slice(array, options) {
if (options === void 0) { options = {}; }
// Extract the options.
var start = options.start, stop = options.stop, step = options.step;
// Set up the `step` value.
if (step === undefined) {
step = 1;
}
// Validate the step size.
if (step === 0) {
throw new Error('Slice `step` cannot be zero.');
}
// Look up the length of the array.
var n = array.length;
// Set up the `start` value.
if (start === undefined) {
start = step < 0 ? n - 1 : 0;
}
else if (start < 0) {
start = Math.max(start + n, step < 0 ? -1 : 0);
}
else if (start >= n) {
start = step < 0 ? n - 1 : n;
}
// Set up the `stop` value.
if (stop === undefined) {
stop = step < 0 ? -1 : n;
}
else if (stop < 0) {
stop = Math.max(stop + n, step < 0 ? -1 : 0);
}
else if (stop >= n) {
stop = step < 0 ? n - 1 : n;
}
// Compute the slice length.
var length;
if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {
length = 0;
}
else if (step < 0) {
length = Math.floor((stop - start + 1) / step + 1);
}
else {
length = Math.floor((stop - start - 1) / step + 1);
}
// Compute the sliced result.
var result = [];
for (var i = 0; i < length; ++i) {
result[i] = array[start + i * step];
}
// Return the result.
return result;
}
ArrayExt.slice = slice;
/**
* Move an element in an array from one index to another.

@@ -608,0 +740,0 @@ *

0

lib/chain.d.ts

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -36,2 +36,35 @@ import { IterableOrArrayLike } from './iter';

/**
* Find the index of the first value which matches a predicate.
*
* @param object - The iterable or array-like object to search.
*
* @param fn - The predicate function to apply to the values.
*
* @returns The index of the first matching value, or `-1` if no
* matching value is found.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { findIndex } from '@phosphor/algorithm';
*
* interface IAnimal { species: string, name: string };
*
* function isCat(value: IAnimal): boolean {
* return value.species === 'cat';
* }
*
* let data: IAnimal[] = [
* { species: 'dog', name: 'spot' },
* { species: 'cat', name: 'fluffy' },
* { species: 'alligator', name: 'pocho' }
* ];
*
* findIndex(data, isCat); // 1
* ```
*/
export declare function findIndex<T>(object: IterableOrArrayLike<T>, fn: (value: T, index: number) => boolean): number;
/**
* Find the minimum value in an iterable.

@@ -38,0 +71,0 @@ *

@@ -56,2 +56,46 @@ "use strict";

/**
* Find the index of the first value which matches a predicate.
*
* @param object - The iterable or array-like object to search.
*
* @param fn - The predicate function to apply to the values.
*
* @returns The index of the first matching value, or `-1` if no
* matching value is found.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { findIndex } from '@phosphor/algorithm';
*
* interface IAnimal { species: string, name: string };
*
* function isCat(value: IAnimal): boolean {
* return value.species === 'cat';
* }
*
* let data: IAnimal[] = [
* { species: 'dog', name: 'spot' },
* { species: 'cat', name: 'fluffy' },
* { species: 'alligator', name: 'pocho' }
* ];
*
* findIndex(data, isCat); // 1
* ```
*/
function findIndex(object, fn) {
var index = 0;
var it = iter_1.iter(object);
var value;
while ((value = it.next()) !== undefined) {
if (fn(value, index++)) {
return index - 1;
}
}
return -1;
}
exports.findIndex = findIndex;
/**
* Find the minimum value in an iterable.

@@ -58,0 +102,0 @@ *

export * from './array';
export * from './chain';
export * from './empty';
export * from './enumerate';
export * from './filter';

@@ -5,0 +6,0 @@ export * from './find';

@@ -16,2 +16,3 @@ "use strict";

__export(require("./empty"));
__export(require("./enumerate"));
__export(require("./filter"));

@@ -18,0 +19,0 @@ __export(require("./find"));

@@ -73,2 +73,91 @@ /**

/**
* Create an iterator for the keys in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the keys in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, keys } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'
* ```
*/
export declare function iterKeys<T>(object: {
readonly [key: string]: T;
}): IIterator<string>;
/**
* Create an iterator for the values in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the values in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, values } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(values(data), value => { console.log(value); }); // 1, 2, 3
* ```
*/
export declare function iterValues<T>(object: {
readonly [key: string]: T;
}): IIterator<T>;
/**
* Create an iterator for the items in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the items in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, items } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]
* ```
*/
export declare function iterItems<T>(object: {
readonly [key: string]: T;
}): IIterator<[string, T]>;
/**
* Create an iterator for an iterator-like function.
*
* @param fn - A function which behaves like an iterator `next` method.
*
* @returns A new iterator for the given function.
*
* #### Notes
* The returned iterator **cannot** be cloned.
*
* #### Example
* ```typescript
* import { each, iterFn } from '@phosphor/algorithm';
*
* let it = iterFn((() => {
* let i = 0;
* return () => i > 3 ? undefined : i++;
* })());
*
* each(it, v => { console.log(v); }); // 0, 1, 2, 3
* ```
*/
export declare function iterFn<T>(fn: () => T | undefined): IIterator<T>;
/**
* Invoke a function for each value in an iterable.

@@ -169,2 +258,21 @@ *

/**
* Create an object from an iterable of key/value pairs.
*
* @param object - The iterable or array-like object of interest.
*
* @returns A new object mapping keys to values.
*
* #### Example
* ```typescript
* import { toObject } from '@phosphor/algorithm';
*
* let data = [['one', 1], ['two', 2], ['three', 3]];
*
* toObject(data); // { one: 1, two: 2, three: 3 }
* ```
*/
export declare function toObject<T>(object: IterableOrArrayLike<[string, T]>): {
[key: string]: T;
};
/**
* An iterator for an array-like object.

@@ -203,1 +311,148 @@ *

}
/**
* An iterator for the keys in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
export declare class KeyIterator implements IIterator<string> {
/**
* Construct a new key iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
constructor(source: {
readonly [key: string]: any;
}, keys?: string[]);
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
iter(): IIterator<string>;
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
clone(): IIterator<string>;
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
next(): string | undefined;
private _index;
private _keys;
private _source;
}
/**
* An iterator for the values in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
export declare class ValueIterator<T> implements IIterator<T> {
/**
* Construct a new value iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
constructor(source: {
readonly [key: string]: T;
}, keys?: string[]);
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
iter(): IIterator<T>;
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
clone(): IIterator<T>;
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
next(): T | undefined;
private _index;
private _keys;
private _source;
}
/**
* An iterator for the items in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
export declare class ItemIterator<T> implements IIterator<[string, T]> {
/**
* Construct a new item iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
constructor(source: {
readonly [key: string]: T;
}, keys?: string[]);
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
iter(): IIterator<[string, T]>;
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
clone(): IIterator<[string, T]>;
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
next(): [string, T] | undefined;
private _index;
private _keys;
private _source;
}
/**
* An iterator for an iterator-like function.
*/
export declare class FnIterator<T> implements IIterator<T> {
/**
* Construct a new function iterator.
*
* @param fn - The iterator-like function of interest.
*/
constructor(fn: () => T | undefined);
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
iter(): IIterator<T>;
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
clone(): IIterator<T>;
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
next(): T | undefined;
private _fn;
}

@@ -33,2 +33,97 @@ "use strict";

/**
* Create an iterator for the keys in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the keys in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, keys } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(keys(data), key => { console.log(key); }); // 'one', 'two', 'three'
* ```
*/
function iterKeys(object) {
return new KeyIterator(object);
}
exports.iterKeys = iterKeys;
/**
* Create an iterator for the values in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the values in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, values } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(values(data), value => { console.log(value); }); // 1, 2, 3
* ```
*/
function iterValues(object) {
return new ValueIterator(object);
}
exports.iterValues = iterValues;
/**
* Create an iterator for the items in an object.
*
* @param object - The object of interest.
*
* @returns A new iterator for the items in the given object.
*
* #### Complexity
* Linear.
*
* #### Example
* ```typescript
* import { each, items } from '@phosphor/algorithm';
*
* let data = { one: 1, two: 2, three: 3 };
*
* each(items(data), value => { console.log(value); }); // ['one', 1], ['two', 2], ['three', 3]
* ```
*/
function iterItems(object) {
return new ItemIterator(object);
}
exports.iterItems = iterItems;
/**
* Create an iterator for an iterator-like function.
*
* @param fn - A function which behaves like an iterator `next` method.
*
* @returns A new iterator for the given function.
*
* #### Notes
* The returned iterator **cannot** be cloned.
*
* #### Example
* ```typescript
* import { each, iterFn } from '@phosphor/algorithm';
*
* let it = iterFn((() => {
* let i = 0;
* return () => i > 3 ? undefined : i++;
* })());
*
* each(it, v => { console.log(v); }); // 0, 1, 2, 3
* ```
*/
function iterFn(fn) {
return new FnIterator(fn);
}
exports.iterFn = iterFn;
/**
* Invoke a function for each value in an iterable.

@@ -171,2 +266,28 @@ *

/**
* Create an object from an iterable of key/value pairs.
*
* @param object - The iterable or array-like object of interest.
*
* @returns A new object mapping keys to values.
*
* #### Example
* ```typescript
* import { toObject } from '@phosphor/algorithm';
*
* let data = [['one', 1], ['two', 2], ['three', 3]];
*
* toObject(data); // { one: 1, two: 2, three: 3 }
* ```
*/
function toObject(object) {
var it = iter(object);
var pair;
var result = {};
while ((pair = it.next()) !== undefined) {
result[pair[0]] = pair[1];
}
return result;
}
exports.toObject = toObject;
/**
* An iterator for an array-like object.

@@ -219,1 +340,208 @@ *

exports.ArrayIterator = ArrayIterator;
/**
* An iterator for the keys in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
var KeyIterator = /** @class */ (function () {
/**
* Construct a new key iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
function KeyIterator(source, keys) {
if (keys === void 0) { keys = Object.keys(source); }
this._index = 0;
this._source = source;
this._keys = keys;
}
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
KeyIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
KeyIterator.prototype.clone = function () {
var result = new KeyIterator(this._source, this._keys);
result._index = this._index;
return result;
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
KeyIterator.prototype.next = function () {
if (this._index >= this._keys.length) {
return undefined;
}
var key = this._keys[this._index++];
if (key in this._source) {
return key;
}
return this.next();
};
return KeyIterator;
}());
exports.KeyIterator = KeyIterator;
/**
* An iterator for the values in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
var ValueIterator = /** @class */ (function () {
/**
* Construct a new value iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
function ValueIterator(source, keys) {
if (keys === void 0) { keys = Object.keys(source); }
this._index = 0;
this._source = source;
this._keys = keys;
}
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
ValueIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
ValueIterator.prototype.clone = function () {
var result = new ValueIterator(this._source, this._keys);
result._index = this._index;
return result;
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
ValueIterator.prototype.next = function () {
if (this._index >= this._keys.length) {
return undefined;
}
var key = this._keys[this._index++];
if (key in this._source) {
return this._source[key];
}
return this.next();
};
return ValueIterator;
}());
exports.ValueIterator = ValueIterator;
/**
* An iterator for the items in an object.
*
* #### Notes
* This iterator can be used for any JS object.
*/
var ItemIterator = /** @class */ (function () {
/**
* Construct a new item iterator.
*
* @param source - The object of interest.
*
* @param keys - The keys to iterate, if known.
*/
function ItemIterator(source, keys) {
if (keys === void 0) { keys = Object.keys(source); }
this._index = 0;
this._source = source;
this._keys = keys;
}
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
ItemIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
ItemIterator.prototype.clone = function () {
var result = new ItemIterator(this._source, this._keys);
result._index = this._index;
return result;
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
ItemIterator.prototype.next = function () {
if (this._index >= this._keys.length) {
return undefined;
}
var key = this._keys[this._index++];
if (key in this._source) {
return [key, this._source[key]];
}
return this.next();
};
return ItemIterator;
}());
exports.ItemIterator = ItemIterator;
/**
* An iterator for an iterator-like function.
*/
var FnIterator = /** @class */ (function () {
/**
* Construct a new function iterator.
*
* @param fn - The iterator-like function of interest.
*/
function FnIterator(fn) {
this._fn = fn;
}
/**
* Get an iterator over the object's values.
*
* @returns An iterator which yields the object's values.
*/
FnIterator.prototype.iter = function () {
return this;
};
/**
* Create an independent clone of the iterator.
*
* @returns A new independent clone of the iterator.
*/
FnIterator.prototype.clone = function () {
throw new Error('An `FnIterator` cannot be cloned.');
};
/**
* Get the next value from the iterator.
*
* @returns The next value from the iterator, or `undefined`.
*/
FnIterator.prototype.next = function () {
return this._fn.call(undefined);
};
return FnIterator;
}());
exports.FnIterator = FnIterator;

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -105,2 +105,12 @@ /**

function highlight<T>(source: string, indices: ReadonlyArray<number>, fn: (chunk: string) => T): Array<string | T>;
/**
* A 3-way string comparison function.
*
* @param a - The first string of interest.
*
* @param b - The second string of interest.
*
* @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.
*/
function cmp(a: string, b: string): number;
}

@@ -171,2 +171,15 @@ "use strict";

StringExt.highlight = highlight;
/**
* A 3-way string comparison function.
*
* @param a - The first string of interest.
*
* @param b - The second string of interest.
*
* @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.
*/
function cmp(a, b) {
return a < b ? -1 : a > b ? 1 : 0;
}
StringExt.cmp = cmp;
})(StringExt = exports.StringExt || (exports.StringExt = {}));

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { IIterator, IterableOrArrayLike } from './iter';

@@ -0,0 +0,0 @@ "use strict";

5

package.json
{
"name": "@phosphor/algorithm",
"version": "1.1.3",
"version": "1.2.0",
"description": "PhosphorJS - Algorithms and Iterators",

@@ -57,3 +57,4 @@ "homepage": "https://github.com/phosphorjs/phosphor",

"webpack": "^2.2.1"
}
},
"gitHead": "7fdcefb4740fbd459c4f25b3c0b8641f94614de0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc