@grey-ts/types 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +42 -14
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -752,7 +752,7 @@ declare namespace GreyHack {
752
752
  /** Waits for the next tick. */
753
753
  function yield(): null;
754
754
  /** Returns the type of the object */
755
- function getType(value: any): keyof GameTypeMap;
755
+ function getType(value: any): string;
756
756
  /** Checks if the given object is of a specific type
757
757
  * @example
758
758
  * const metax = includeLib("/lib/metaxploit.so");
@@ -776,7 +776,7 @@ declare namespace GreyHack {
776
776
  * include("./commands");
777
777
  */
778
778
  function include(file: string): void;
779
- type LibTypes = {
779
+ interface LibTypes {
780
780
  "aptclient.so": GreyHack.AptClient;
781
781
  "metaxploit.so": GreyHack.Metaxploit;
782
782
  "crypto.so": GreyHack.Crypto;
@@ -786,7 +786,7 @@ declare namespace GreyHack {
786
786
  "blockchain.so": GreyHack.BlockChain;
787
787
  "libsmartappliance.so": GreyHack.SmartAppliance;
788
788
  "libtrafficnet.so": GreyHack.TrafficNet;
789
- };
789
+ }
790
790
  }
791
791
  declare var activeUser: typeof GreyHack.activeUser;
792
792
  declare var bitAnd: typeof GreyHack.bitAnd;
@@ -835,18 +835,18 @@ declare var yield: typeof GreyHack.yield;
835
835
  declare const getType: typeof GreyHack.getType;
836
836
  declare const isType: typeof GreyHack.isType;
837
837
  declare const include: typeof GreyHack.include;
838
- type OtherTypeMap = {
838
+ interface PrimitiveTypeMap {
839
839
  "null": null;
840
- "pcomputer": unknown;
841
- "pfile": unknown;
842
- "prouter": unknown;
843
840
  "number": number;
844
841
  "list": Array<any>;
845
842
  "map": Record<string, any>;
846
843
  "function": Function;
847
844
  "string": string;
848
- };
849
- type ClassIDMap = {
845
+ }
846
+ interface ClassIDMap {
847
+ "pcomputer": unknown;
848
+ "pfile": unknown;
849
+ "prouter": unknown;
850
850
  "aptClientLib": GreyHack.AptClient;
851
851
  "blockChainLib": GreyHack.BlockChain;
852
852
  "ctfEvent": GreyHack.CtfEvent;
@@ -870,8 +870,8 @@ type ClassIDMap = {
870
870
  "subwallet": GreyHack.SubWallet;
871
871
  "TrafficNet": GreyHack.TrafficNet;
872
872
  "wallet": GreyHack.Wallet;
873
- };
874
- type GameTypeMap = ClassIDMap & OtherTypeMap;
873
+ }
874
+ type GameTypeMap = ClassIDMap & PrimitiveTypeMap;
875
875
  declare namespace GreyHack {
876
876
  interface Service {
877
877
  classID: "service";
@@ -1540,12 +1540,23 @@ interface String {
1540
1540
  * In case the string is not numeric it will return the original string.
1541
1541
  */
1542
1542
  toInt(): string | number;
1543
- /** Removes the leading and trailing white space and line terminator characters from a string. */
1543
+ /** Removes the leading and trailing white space characters from a string. */
1544
1544
  trim(): string;
1545
1545
  /** Returns a number which is parsed from the string. In case the string is not numeric it will return a zero. */
1546
1546
  val(): number;
1547
1547
  /** Returns an array where each item is a string representing all available characters in the string. Could be compared to using {@link String.split|split} but with empty separator. */
1548
1548
  values(): string[];
1549
+ /** Removes the leading white space characters from a string. */
1550
+ trimStart(): string;
1551
+ /** Removes the trailing white space characters from a string. */
1552
+ trimEnd(): string;
1553
+ /**
1554
+ * Returns true if searchString appears as a substring of this string, at one or more positions that are greater than or equal to position; otherwise, returns false.
1555
+ *
1556
+ * @param searchString search string
1557
+ * @param position If position is undefined, 0 is assumed, so as to search all of the string.
1558
+ */
1559
+ includes(searchString: string, position?: number): boolean;
1549
1560
  /** Returns true if this string starts with the searchString. Otherwise returns false. */
1550
1561
  startsWith(searchString: string, position?: number): boolean;
1551
1562
  /** Returns true if this string ends with the searchString. Otherwise returns false. */
@@ -1569,6 +1580,11 @@ interface String {
1569
1580
  interface Number {
1570
1581
  /** Returns a string representation of a number. */
1571
1582
  toString(): string;
1583
+ /**
1584
+ * Returns a string representing a number in fixed-point notation.
1585
+ * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
1586
+ */
1587
+ toFixed(fractionDigits?: number): string;
1572
1588
  }
1573
1589
  type PropertyKey = number | string | symbol;
1574
1590
  interface Object {
@@ -1681,7 +1697,10 @@ interface Array<T> {
1681
1697
  /** Returns a sum of all values inside the array. Any non-numeric values will be considered a zero. */
1682
1698
  sum(): number;
1683
1699
  values(): T[];
1684
- /** Combines two or more arrays. This method returns a new array without modifying any existing arrays.
1700
+ /** Determines whether an array includes a certain element, returning true or false as appropriate. */
1701
+ includes(searchElement: T, fromIndex?: number): boolean;
1702
+ /**
1703
+ * Combines two or more arrays. This method returns a new array without modifying any existing arrays.
1685
1704
  * @param items Additional arrays and/or items to add to the end of the array.
1686
1705
  */
1687
1706
  concat(...items: (T | T[])[]): T[];
@@ -1695,13 +1714,22 @@ interface Array<T> {
1695
1714
  some(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
1696
1715
  /** Determines whether all the members of an array satisfy the specified test. */
1697
1716
  every(predicate: (value: T, index: number, array: T[]) => unknown): boolean;
1698
- /** Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array.
1717
+ /**
1718
+ * Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array.
1699
1719
  *
1700
1720
  * For example, -2 refers to the second to last element of the array.
1701
1721
  * @param start The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
1702
1722
  * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.
1703
1723
  * */
1704
1724
  slice(start?: number, end?: number): T[];
1725
+ /**
1726
+ * Removes elements from an array and returns the deleted elements.
1727
+ *
1728
+ * For example, -2 refers to the second to last element of the array.
1729
+ * @param start The zero-based location in the array from which to start removing elements
1730
+ * @param end The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array.
1731
+ * */
1732
+ splice(start: number, deleteCount?: number): T[];
1705
1733
  /** Returns a string representation of an array. */
1706
1734
  toString(): string;
1707
1735
  [n: number]: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grey-ts/types",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "TypeScript definitions for GreyHack's functions and objects",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",