@bevry/ecmascript-versions
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -22,2 +22,10 @@ /** | ||
}; | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export declare function compareESVersionInformation(a: ESVersionInformation, b: ESVersionInformation): number; | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export declare function compareESVersionIdentifier(a: ESVersionIdentifier, b: ESVersionIdentifier): number; | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export declare function sortESVersionIdentifiers(versions: Array<ESVersionIdentifier>): string[]; | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export declare function sortESVersionInformation(versions: Array<ESVersionInformation>): ESVersionInformation[]; | ||
/** Get the associated ECMAScript version information for the version identifier. */ | ||
@@ -27,3 +35,3 @@ export declare function getESVersionInformationByVersion(version: ESVersionIdentifier): ESVersionInformation; | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -33,3 +41,3 @@ export declare function getESVersionsInformationByVersion(versions: Array<ESVersionIdentifier>): Array<ESVersionInformation>; | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -39,3 +47,3 @@ export declare function getESVersionsInformationByDate(when: Date): Array<ESVersionInformation>; | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -49,3 +57,3 @@ export declare function getESVersionsByDate(when: Date): Array<ESVersionIdentifier>; | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -55,3 +63,3 @@ export declare function getESVersionsInformationByNow(): ESVersionInformation[]; | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -58,0 +66,0 @@ export declare function getESVersionsByNow(): string[]; |
@@ -23,3 +23,3 @@ /** | ||
* ECMAScript version information mapped by the edition number. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -63,3 +63,3 @@ const esVersionsByEdition = new Map(); | ||
* ECMAScript version information as an array. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -69,6 +69,24 @@ const esVersionList = Array.from(esVersionsByEdition.values()); | ||
* ECMAScript version information mapped by the version identifier. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
const esVersionsByVersion = new Map(esVersionList.map((v) => [v.version, v])); | ||
// ------------------------------------ | ||
// Helpers | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function compareESVersionInformation(a, b) { | ||
return a.ratified.getTime() - b.ratified.getTime(); | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function compareESVersionIdentifier(a, b) { | ||
return compareESVersionInformation(getESVersionInformationByVersion(a), getESVersionInformationByVersion(b)); | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function sortESVersionIdentifiers(versions) { | ||
return versions.sort(compareESVersionIdentifier); | ||
} | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function sortESVersionInformation(versions) { | ||
return versions.sort(compareESVersionInformation); | ||
} | ||
// ------------------------------------ | ||
// By Version | ||
@@ -83,6 +101,8 @@ /** Get the associated ECMAScript version information for the version identifier. */ | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
export function getESVersionsInformationByVersion(versions) { | ||
return versions.map((version) => getESVersionInformationByVersion(version)); | ||
return versions | ||
.map((version) => getESVersionInformationByVersion(version)) | ||
.sort(compareESVersionInformation); | ||
} | ||
@@ -93,3 +113,3 @@ // ------------------------------------ | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -105,3 +125,3 @@ export function getESVersionsInformationByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -123,3 +143,3 @@ export function getESVersionsByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -131,3 +151,3 @@ export function getESVersionsInformationByNow() { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -134,0 +154,0 @@ export function getESVersionsByNow() { |
@@ -42,3 +42,3 @@ /** | ||
* ECMAScript version information mapped by the edition number. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -87,3 +87,3 @@ const esVersionsByEdition: Map<Number, ESVersionInformation> = new Map() | ||
* ECMAScript version information as an array. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -94,3 +94,3 @@ const esVersionList = Array.from(esVersionsByEdition.values()) | ||
* ECMAScript version information mapped by the version identifier. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -101,2 +101,36 @@ const esVersionsByVersion: Map<ESVersionIdentifier, ESVersionInformation> = | ||
// ------------------------------------ | ||
// Helpers | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function compareESVersionInformation( | ||
a: ESVersionInformation, | ||
b: ESVersionInformation | ||
): number { | ||
return a.ratified.getTime() - b.ratified.getTime() | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function compareESVersionIdentifier( | ||
a: ESVersionIdentifier, | ||
b: ESVersionIdentifier | ||
): number { | ||
return compareESVersionInformation( | ||
getESVersionInformationByVersion(a), | ||
getESVersionInformationByVersion(b) | ||
) | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function sortESVersionIdentifiers(versions: Array<ESVersionIdentifier>) { | ||
return versions.sort(compareESVersionIdentifier) | ||
} | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function sortESVersionInformation( | ||
versions: Array<ESVersionInformation> | ||
) { | ||
return versions.sort(compareESVersionInformation) | ||
} | ||
// ------------------------------------ | ||
// By Version | ||
@@ -114,3 +148,3 @@ | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -120,3 +154,5 @@ export function getESVersionsInformationByVersion( | ||
): Array<ESVersionInformation> { | ||
return versions.map((version) => getESVersionInformationByVersion(version)) | ||
return versions | ||
.map((version) => getESVersionInformationByVersion(version)) | ||
.sort(compareESVersionInformation) | ||
} | ||
@@ -129,3 +165,3 @@ | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -145,3 +181,3 @@ export function getESVersionsInformationByDate( | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -169,3 +205,3 @@ export function getESVersionsByDate(when: Date): Array<ESVersionIdentifier> { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -178,3 +214,3 @@ export function getESVersionsInformationByNow() { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -181,0 +217,0 @@ export function getESVersionsByNow() { |
@@ -23,3 +23,3 @@ /** | ||
* ECMAScript version information mapped by the edition number. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -63,3 +63,3 @@ const esVersionsByEdition = new Map(); | ||
* ECMAScript version information as an array. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -69,6 +69,24 @@ const esVersionList = Array.from(esVersionsByEdition.values()); | ||
* ECMAScript version information mapped by the version identifier. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
const esVersionsByVersion = new Map(esVersionList.map((v) => [v.version, v])); | ||
// ------------------------------------ | ||
// Helpers | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function compareESVersionInformation(a, b) { | ||
return a.ratified.getTime() - b.ratified.getTime(); | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function compareESVersionIdentifier(a, b) { | ||
return compareESVersionInformation(getESVersionInformationByVersion(a), getESVersionInformationByVersion(b)); | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function sortESVersionIdentifiers(versions) { | ||
return versions.sort(compareESVersionIdentifier); | ||
} | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function sortESVersionInformation(versions) { | ||
return versions.sort(compareESVersionInformation); | ||
} | ||
// ------------------------------------ | ||
// By Version | ||
@@ -83,6 +101,8 @@ /** Get the associated ECMAScript version information for the version identifier. */ | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
export function getESVersionsInformationByVersion(versions) { | ||
return versions.map((version) => getESVersionInformationByVersion(version)); | ||
return versions | ||
.map((version) => getESVersionInformationByVersion(version)) | ||
.sort(compareESVersionInformation); | ||
} | ||
@@ -93,3 +113,3 @@ // ------------------------------------ | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -105,3 +125,3 @@ export function getESVersionsInformationByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -123,3 +143,3 @@ export function getESVersionsByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -131,3 +151,3 @@ export function getESVersionsInformationByNow() { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -134,0 +154,0 @@ export function getESVersionsByNow() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getESVersionByEdition = exports.getESVersionInformationByEdition = exports.getESVersionByNow = exports.getESVersionInformationByNow = exports.getESVersionsByNow = exports.getESVersionsInformationByNow = exports.getESVersionByDate = exports.getESVersionInformationByDate = exports.getESVersionsByDate = exports.getESVersionsInformationByDate = exports.getESVersionsInformationByVersion = exports.getESVersionInformationByVersion = exports.getDateWithYearOffset = exports.datetime = void 0; | ||
exports.getESVersionByEdition = exports.getESVersionInformationByEdition = exports.getESVersionByNow = exports.getESVersionInformationByNow = exports.getESVersionsByNow = exports.getESVersionsInformationByNow = exports.getESVersionByDate = exports.getESVersionInformationByDate = exports.getESVersionsByDate = exports.getESVersionsInformationByDate = exports.getESVersionsInformationByVersion = exports.getESVersionInformationByVersion = exports.sortESVersionInformation = exports.sortESVersionIdentifiers = exports.compareESVersionIdentifier = exports.compareESVersionInformation = exports.getDateWithYearOffset = exports.datetime = void 0; | ||
/** | ||
@@ -28,3 +28,3 @@ * The datetime to use by default. | ||
* ECMAScript version information mapped by the edition number. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -68,3 +68,3 @@ const esVersionsByEdition = new Map(); | ||
* ECMAScript version information as an array. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -74,6 +74,28 @@ const esVersionList = Array.from(esVersionsByEdition.values()); | ||
* ECMAScript version information mapped by the version identifier. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
const esVersionsByVersion = new Map(esVersionList.map((v) => [v.version, v])); | ||
// ------------------------------------ | ||
// Helpers | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
function compareESVersionInformation(a, b) { | ||
return a.ratified.getTime() - b.ratified.getTime(); | ||
} | ||
exports.compareESVersionInformation = compareESVersionInformation; | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
function compareESVersionIdentifier(a, b) { | ||
return compareESVersionInformation(getESVersionInformationByVersion(a), getESVersionInformationByVersion(b)); | ||
} | ||
exports.compareESVersionIdentifier = compareESVersionIdentifier; | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
function sortESVersionIdentifiers(versions) { | ||
return versions.sort(compareESVersionIdentifier); | ||
} | ||
exports.sortESVersionIdentifiers = sortESVersionIdentifiers; | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
function sortESVersionInformation(versions) { | ||
return versions.sort(compareESVersionInformation); | ||
} | ||
exports.sortESVersionInformation = sortESVersionInformation; | ||
// ------------------------------------ | ||
// By Version | ||
@@ -89,6 +111,8 @@ /** Get the associated ECMAScript version information for the version identifier. */ | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
function getESVersionsInformationByVersion(versions) { | ||
return versions.map((version) => getESVersionInformationByVersion(version)); | ||
return versions | ||
.map((version) => getESVersionInformationByVersion(version)) | ||
.sort(compareESVersionInformation); | ||
} | ||
@@ -100,3 +124,3 @@ exports.getESVersionsInformationByVersion = getESVersionsInformationByVersion; | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -113,3 +137,3 @@ function getESVersionsInformationByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -134,3 +158,3 @@ function getESVersionsByDate(when) { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -143,3 +167,3 @@ function getESVersionsInformationByNow() { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -146,0 +170,0 @@ function getESVersionsByNow() { |
# History | ||
## v3.1.0 2021 July 27 | ||
- Added `sort*` and `compare*` functions | ||
- Results from `getESVersionsInformationByVersion` are now sorted | ||
## v3.0.0 2021 July 27 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "@bevry/ecmascript-versions", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Get all ECMAScript versions, or the ECMAScript version that was ratified on a specific date.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/es-versions", |
@@ -91,3 +91,3 @@ <!-- TITLE/ --> | ||
<script type="module"> | ||
import * as pkg from '//cdn.skypack.dev/@bevry/ecmascript-versions@^3.0.0' | ||
import * as pkg from '//cdn.skypack.dev/@bevry/ecmascript-versions@^3.1.0' | ||
</script> | ||
@@ -100,3 +100,3 @@ ``` | ||
<script type="module"> | ||
import * as pkg from '//unpkg.com/@bevry/ecmascript-versions@^3.0.0' | ||
import * as pkg from '//unpkg.com/@bevry/ecmascript-versions@^3.1.0' | ||
</script> | ||
@@ -109,3 +109,3 @@ ``` | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/@bevry/ecmascript-versions@3.0.0' | ||
import * as pkg from '//dev.jspm.io/@bevry/ecmascript-versions@3.1.0' | ||
</script> | ||
@@ -112,0 +112,0 @@ ``` |
@@ -42,3 +42,3 @@ /** | ||
* ECMAScript version information mapped by the edition number. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -87,3 +87,3 @@ const esVersionsByEdition: Map<Number, ESVersionInformation> = new Map() | ||
* ECMAScript version information as an array. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -94,3 +94,3 @@ const esVersionList = Array.from(esVersionsByEdition.values()) | ||
* ECMAScript version information mapped by the version identifier. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -101,2 +101,36 @@ const esVersionsByVersion: Map<ESVersionIdentifier, ESVersionInformation> = | ||
// ------------------------------------ | ||
// Helpers | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function compareESVersionInformation( | ||
a: ESVersionInformation, | ||
b: ESVersionInformation | ||
): number { | ||
return a.ratified.getTime() - b.ratified.getTime() | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function compareESVersionIdentifier( | ||
a: ESVersionIdentifier, | ||
b: ESVersionIdentifier | ||
): number { | ||
return compareESVersionInformation( | ||
getESVersionInformationByVersion(a), | ||
getESVersionInformationByVersion(b) | ||
) | ||
} | ||
/** Sort the ECMAScript version identifiers by oldest ratification date first. */ | ||
export function sortESVersionIdentifiers(versions: Array<ESVersionIdentifier>) { | ||
return versions.sort(compareESVersionIdentifier) | ||
} | ||
/** Sort the ECMAScript version information by oldest ratification date first. */ | ||
export function sortESVersionInformation( | ||
versions: Array<ESVersionInformation> | ||
) { | ||
return versions.sort(compareESVersionInformation) | ||
} | ||
// ------------------------------------ | ||
// By Version | ||
@@ -114,3 +148,3 @@ | ||
* Get all the associated ECMAScript version information for the version identifiers. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -120,3 +154,5 @@ export function getESVersionsInformationByVersion( | ||
): Array<ESVersionInformation> { | ||
return versions.map((version) => getESVersionInformationByVersion(version)) | ||
return versions | ||
.map((version) => getESVersionInformationByVersion(version)) | ||
.sort(compareESVersionInformation) | ||
} | ||
@@ -129,3 +165,3 @@ | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -145,3 +181,3 @@ export function getESVersionsInformationByDate( | ||
* Get all the ECMAScript versions that have been ratified by the specified datetime. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -169,3 +205,3 @@ export function getESVersionsByDate(when: Date): Array<ESVersionIdentifier> { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -178,3 +214,3 @@ export function getESVersionsInformationByNow() { | ||
* Get all the ECMAScript versions that have been ratified by the current datetime, or {@link datetime}. | ||
* Sorted from oldest first to most recent last. | ||
* Sorted from oldest ratification date first. | ||
*/ | ||
@@ -181,0 +217,0 @@ export function getESVersionsByNow() { |
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
61471
1027