diff --git a/docs/assets/search.js b/docs/assets/search.js index b56da4f..516aae7 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACr2c23LbyBGG34W+pWnNEZDusnZtxUllN6l15calckHkyEJMEgoA2nFUfvfMgADRDXaTA4LOFU1zuvuf/hpzAAZ6mZXFt2p29/Fl9iXfrmZ3cj7bZhs3u5v5r+4/s/lsV679t02x2q1d9ab538VTvVn7n5brrKqcN5/NfsyPPVTl8s3bYr12yzovtkeu/M+f+p9P+hQyPXglPLY2Q48nnc9nz1nptvWxzj6sEX1nlsW2qsvdsi7KkXFfYdMYDQtSjrzRfRoe87KqxyrpjK6kwXsZLaG1uZKCMtuuis1YDQerK6lYFrvt6ER0RlfSsNvm/965sSIOVldSsXJrV49WcbCaoAKNOu+yOnvIKkeOOd2P0SPOkTfYrYO3E24HfTn4A+FupO6T+PCHq+t8+7kaEfEVsuqD19XqdV69fi7zr1mTY1LKgtBkjVH2IOrTp/r785gUAEGLg/H5pPROQIeYRD0VzPgTq2jRerhMVtctRt2ucvRUEa2u9fBT1D17n9+KcjVNIfDyU1Suxl96hErg5Voq0ahXufr35zAgjbpgkdUIXRcuUBgVsYuTUzIQMu9we2J9xsvora4xeg0m6Mb7BYIuzgmeFvPqAgnI6goq/Exffh8joDO4MDaakv/s1s9gPIQT8v6n6Ol44An2o/XEOhyobz0x6fqvK4u/Z/QAeRzoVd/8XMDF6bh+tHIf8o37tSg3GV0wRPgjq/EqxowmhILYkYRNAqqXvxV+VUiWS/NLdLVgP7ALez+ct4HovRt2L7aly2QY4lXb8kycxdlov5e/Znlct16h9pMi755Dlf1evi1dxqzyj6If2UxSsHK+xAp6EDsK3TeeFJMfNo8inh8wI+Jl60iw+4aTYm3dt/f+qs22y0ic2GBs7DEjzFHo2PGFDo3WKH6uWkd2uGtKrEmK2k/NbnVBfL+e2WTl97+6yLpC7a+q5Iv7/oHb1x3J6BtfVcNjvl7H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Azbt2pboIwYkH3LIfdlMlwMKBBNc7jXGU4/rErGpH1oDzgDgaqbi7iAW/ctP7x0AMTCyYgbz5qnAQ8opQkYQVMupa3dsn38DEZREDXhrYlLCYTVnNz+hVpQ3gCK4GC2rwgMLn0F2GiuUNu3VgAcoFS207zi0DbWD935FpAncInYW8a4+0sMwAxYcUbdCTxQgkCxYYO1J5SZhSMYlTXvoj0qBkKDwcdy48f+XCQIBqYpw9VC92QWJAdkJ+E0+pVK0b1XDIoIXHCCW/SFlwpW3UsFoIqAWs2VfHicRa+r4TrthDG5xgNFJLj6DcbETAKX86dEH49NIMuSzbK35ErfgHxZLtdHM6YChaS4sHXxrwpn14BL3HL9bI+QAiuQHcsl9nCwDtiB2dJyhdv9VZHeDFhx+eiO8oJYAL45beYXZ+37hSCfwFxxF+b+TyyAggPZFNyQ155SANcluLhSLpuN1bI7eQWMAYqE09kY5wh8AvqXnrQbLA4sKM+UW0buDXd4X28hR+5aDi9CP2d4QQ9KW5LD+v189pw/u3W+9Y0+3v/48T/dQoB6mkoAAA=="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACr2cXXPbuhGG/4t8qygBAQKU785J5kzTTk/aOZneZDwZWoJtNpKoklRyUo//ewF+iLvUrkSKdK8cRdjdF3gWwIIfep5l6Y98dvvlefYt2a1nt8F8tou3dnY7cx/tn7P57JBt3Kdtuj5sbP62/N/FU7HduK9WmzjPrTOfzV7mpx7ybPX2fbrZ2FWRpLsTV+7rr+3XZ32KIDp6JTzWNl2PZ53PZ/s4s7viVGcbNhRtZ1bpLi+yw6pIs4Fxb7BpHw0LUk7wTrXD8JBkeTFUSWM0kQbnZbCE2mYiBVm8W6fboRqOVhOpWKWH3eCBaIwm0nDYJf852KEijlYTqVjbjS0GqzhaTaSiSH/JsvjnUBmt2UQ6bLx6GiqitplIwdZmj4NxNEYTacgPgydoZTJR/Pj749D4lclUDOI/BxMoTaaKnwzdKW8qk4ni7zeH1behChqjERpQHfIhLuL7O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RQOjLNlRdpZs6sPSnh3rA8p7AWaq4ObaSeWgQPIpTmqRxtXPLoFoYHAEtykX6b9zTFIDkYYb0/rZaWAFgmkO4vGJUmAH1gLDTZLmB7ZAyQjmCGdUP8MOJiSw0hyyyswVt/WLtSBlgLnikrz6bREwJcFoBhzy+vEcsAaAiRxxHSytVs0jh8AYoIg4naUxLg0M6N/yrF2nuDJgKiy5RKsMD/gCjAH0I66e8L8AsI/xgQhMCUnusXfz2T7Z202yc42+3L28/A9P14PWpVEAAA=="; \ No newline at end of file diff --git a/docs/classes/src_Collection.Collection.html b/docs/classes/src_Collection.Collection.html index 1a89da4..0400406 100644 --- a/docs/classes/src_Collection.Collection.html +++ b/docs/classes/src_Collection.Collection.html @@ -1,15 +1,17 @@ Collection | nodequent

A collection class that extends the Array class. Mostly for convenience.

-

Hierarchy

  • Array
    • Collection

Constructors

Hierarchy

  • Array
    • Collection

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' +

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

Type declaration

  • Optional Readonly [unscopables]?: boolean

    Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    @@ -56,7 +64,10 @@

    Returns IterableIterator<any>

  • Takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.

    -

    Parameters

    • index: number

    Returns any

  • Combines two or more arrays. +

    Parameters

    • index: number

    Returns any

  • Get the average of all items in the collection.

    +

    Returns number

    The average of all items

    +

    Since

    1.0.6

    +
  • Combines two or more arrays. This method returns a new array without modifying any existing arrays.

    Parameters

    • Rest ...items: ConcatArray<any>[]

      Additional arrays and/or items to add to the end of the array.

    Returns any[]

  • Combines two or more arrays. @@ -71,9 +82,13 @@

  • Optional end: number

    If not specified, length of the this object is used as its default value.

Returns this

Returns U[]

Returns U[]

\ No newline at end of file +

Returns T[]

\ No newline at end of file diff --git a/docs/classes/src_Database.Database.html b/docs/classes/src_Database.Database.html index eef412b..81258f7 100644 --- a/docs/classes/src_Database.Database.html +++ b/docs/classes/src_Database.Database.html @@ -1,5 +1,5 @@ Database | nodequent

Database class to handle database connections and interactions.

-

Constructors

Constructors

Properties

Methods

connect @@ -9,9 +9,9 @@

Constructors

  • Create a new instance of the Database class.

    Parameters

    • Optional options: any

      The options to use for the database connection.

    Returns Database

    void

    -

Properties

connection: any = null
dbSettings: {
    database: string;
    host: string;
    password: string;
    user: string;
}

Type declaration

  • database: string
  • host: string
  • password: string
  • user: string

Methods

Properties

connection: any = null
dbSettings: {
    database: string;
    host: string;
    password: string;
    user: string;
}

Type declaration

  • database: string
  • host: string
  • password: string
  • user: string

Methods

  • Disconnect from the database.

    Returns void

    void

    -
  • Parameters

    • sql: string

    Returns Promise<unknown>

  • Set the default database options. Mainly for the init function.

    -

    Parameters

    • options: {
          database: string;
          host: string;
          password: string;
          user: string;
      }
      • database: string
      • host: string
      • password: string
      • user: string

    Returns void

\ No newline at end of file +
\ No newline at end of file diff --git a/docs/classes/src_Helper.Helper.html b/docs/classes/src_Helper.Helper.html index 02fa595..159e365 100644 --- a/docs/classes/src_Helper.Helper.html +++ b/docs/classes/src_Helper.Helper.html @@ -1,4 +1,4 @@ -Helper | nodequent

Constructors

constructor +Helper | nodequent

Constructors

Methods

Constructors

Methods

  • Parameters

    • date: any

    Returns string

  • Parameters

    • num: number
    • places: number

    Returns string

\ No newline at end of file +

Constructors

Methods

  • Parameters

    • date: any

    Returns string

  • Parameters

    • num: number
    • places: number

    Returns string

\ No newline at end of file diff --git a/docs/classes/src_Model.Model.html b/docs/classes/src_Model.Model.html index 628e0c2..fd92d15 100644 --- a/docs/classes/src_Model.Model.html +++ b/docs/classes/src_Model.Model.html @@ -1,5 +1,5 @@ Model | nodequent

Base class for all models.

-

Constructors

Constructors

Properties

Constructors

Properties

attributes: {} = {}

Type declaration

    Var

    object The model's attributes.

    -
    fillable: string[] = []

    Var

    string[] The attributes that are mass assignable.

    -
    incrementing: boolean = true

    Var

    bool Indicates if the IDs are auto-incrementing.

    -
    keyType: string = 'int'

    Var

    string The type of the primary key.

    -
    original: {} = {}

    Type declaration

      Var

      object The original attributes of the model.

      +

      Constructors

      Properties

      attributes: {} = {}

      Type declaration

        Var

        object The model's attributes.

        +
        fillable: string[] = []

        Var

        string[] The attributes that are mass assignable.

        +
        incrementing: boolean = true

        Var

        bool Indicates if the IDs are auto-incrementing.

        +
        keyType: string = 'int'

        Var

        string The type of the primary key.

        +
        original: {} = {}

        Type declaration

          Var

          object The original attributes of the model.

          Since

          1.0.5

          -
          primaryKey: string = 'id'

          Var

          string The primary key for the model.

          -
          softDeletes: boolean = false

          Var

          bool Whether or not soft deletes are enabled.

          -
          table: string

          Var

          string The table associated with the model.

          -

          Methods

          • Clear the model's attributes.

            -

            Returns void

          • Remove the model from the database

            +
          primaryKey: string = 'id'

          Var

          string The primary key for the model.

          +
          softDeletes: boolean = false

          Var

          bool Whether or not soft deletes are enabled.

          +
          table: string

          Var

          string The table associated with the model.

          +

          Methods

          • Clear the model's attributes.

            +

            Returns void

          • Remove the model from the database

            Returns Promise<unknown>

            void

            -
          • Delete the model from the database, regardless of soft deletes.

            +
          • Delete the model from the database, regardless of soft deletes.

            Returns Promise<unknown>

            void

            -
          • Gets attributes that are different than the original attributes.

            +
          • Gets attributes that are different than the original attributes.

            Returns {}

            object The model's dirty attributes

              Since

              1.0.5

              -
            • Get the value of the primary key

              Returns any

              The primary key

              -
            • Get the original value of an attribute.

              +
            • Get the original value of an attribute.

              Parameters

              • key: string

                The attribute

              Returns any

              The value of the attribute

              Since

              1.0.5

              -
            • Get the table name

              Returns string

              The table name

              -
            • Check if the model is the same as another model.

              +
            • Check if the model is the same as another model.

              Parameters

              • model: Model

                The model to check against

              Returns boolean

              boolean

              -
            • Check if the model, or a specific attribute, is dirty.

              +
            • Check if the model, or a specific attribute, is dirty.

              Parameters

              • Optional key: string

                The attribute to check

              Returns boolean

              boolean

              Since

              1.0.5

              -
            • Check if the model is not the same as another model.

              +
            • Check if the model is not the same as another model.

              Parameters

              • model: Model

                The model to check against

              Returns boolean

              boolean

              -
            • Refresh the model from the database

              +
            • Refresh the model from the database

              Returns Promise<unknown>

              Model

              -
            • Register getters and setters for the model's attributes.

              +
            • Register getters and setters for the model's attributes.

              Parameters

              • attributes: any = {}

                The attributes to register.

                -

              Returns void

            • Restore a soft-deleted model. Only works if soft deletes are enabled.

              +

            Returns void

            \ No newline at end of file +
            \ No newline at end of file diff --git a/docs/classes/src_QueryBuilder.QueryBuilder.html b/docs/classes/src_QueryBuilder.QueryBuilder.html index cf02e28..2f35c5c 100644 --- a/docs/classes/src_QueryBuilder.QueryBuilder.html +++ b/docs/classes/src_QueryBuilder.QueryBuilder.html @@ -1,5 +1,5 @@ QueryBuilder | nodequent

            Builds SQL queries for models.

            -

            Constructors

            Constructors

            Properties

            Constructors

            Properties

            columns: string[] = []
            connection: any
            model: any
            orderByClause: {
                column: string;
                direction: string;
            } = ...

            Type declaration

            • column: string
            • direction: string
            whereClauses: {
                column: string;
                operator: string;
                value: any;
            }[] = []

            Type declaration

            • column: string
            • operator: string
            • value: any

            Methods

            • Parameters

              • column: string

                The column to order by

                +

            Constructors

            Properties

            columns: string[] = []
            connection: any
            model: any
            orderByClause: {
                column: string;
                direction: string;
            } = ...

            Type declaration

            • column: string
            • direction: string
            whereClauses: {
                column: string;
                operator: string;
                value: any;
            }[] = []

            Type declaration

            • column: string
            • operator: string
            • value: any

            Methods

            • Parameters

              • column: string

                The column to order by

              • direction: string = 'asc'

                The direction to order in

              Returns this

              QueryBuilder

              -
            • Select columns

              Parameters

              • Rest ...columns: string[]

                Columns to select.

              Returns this

              QueryBuilder

              -
            • Add a WHERE clause to the query.

              Parameters

              • column: string

                The column to check on

              • Optional operator: any

                The operator to use

              • Optional value: any

                The value to check against

              Returns this

              QueryBuilder

              -
            • Convenience method for where(column, 'IN', values)

              +
            • Convenience method for where(column, 'IN', values)

              Parameters

              • column: string

                The column to check on

              • values: any[]

                The values to check against

              Returns this

              QueryBuilder

              -
            • Convenience method for the inverse of where()

              Parameters

              • column: string

                The column to check on

              • value: any

                The value to check against

              Returns this

              QueryBuilder

              -
            • Where clause to check for null values

              Parameters

              • column: string

                The column to check on

              Returns this

              QueryBuilder

              -
            \ No newline at end of file +
            \ No newline at end of file diff --git a/docs/modules/index.html b/docs/modules/index.html index 452f16f..4a4009a 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -1 +1 @@ -index | nodequent

            Module index

            \ No newline at end of file +index | nodequent

            Module index

            \ No newline at end of file diff --git a/docs/modules/src_Collection.html b/docs/modules/src_Collection.html index 3ea6846..e6f4a89 100644 --- a/docs/modules/src_Collection.html +++ b/docs/modules/src_Collection.html @@ -1,2 +1,2 @@ -src/Collection | nodequent

            Module src/Collection

            Index

            Classes

            Collection +src/Collection | nodequent

            Module src/Collection

            Index

            Classes

            \ No newline at end of file diff --git a/docs/modules/src_Database.html b/docs/modules/src_Database.html index 430a112..69223b2 100644 --- a/docs/modules/src_Database.html +++ b/docs/modules/src_Database.html @@ -1,2 +1,2 @@ -src/Database | nodequent

            Module src/Database

            Index

            Classes

            Database +src/Database | nodequent

            Module src/Database

            Index

            Classes

            \ No newline at end of file diff --git a/docs/modules/src_Helper.html b/docs/modules/src_Helper.html index d0ba037..109c898 100644 --- a/docs/modules/src_Helper.html +++ b/docs/modules/src_Helper.html @@ -1,2 +1,2 @@ -src/Helper | nodequent

            Module src/Helper

            Index

            Classes

            Helper +src/Helper | nodequent

            Module src/Helper

            Index

            Classes

            \ No newline at end of file diff --git a/docs/modules/src_Model.html b/docs/modules/src_Model.html index 62917c2..f1efe87 100644 --- a/docs/modules/src_Model.html +++ b/docs/modules/src_Model.html @@ -1,2 +1,2 @@ -src/Model | nodequent

            Module src/Model

            Index

            Classes

            Model +src/Model | nodequent

            Module src/Model

            Index

            Classes

            \ No newline at end of file diff --git a/docs/modules/src_QueryBuilder.html b/docs/modules/src_QueryBuilder.html index 3f4f6b8..0d264e1 100644 --- a/docs/modules/src_QueryBuilder.html +++ b/docs/modules/src_QueryBuilder.html @@ -1,2 +1,2 @@ -src/QueryBuilder | nodequent

            Module src/QueryBuilder

            Index

            Classes

            QueryBuilder +src/QueryBuilder | nodequent

            Module src/QueryBuilder

            Index

            Classes

            \ No newline at end of file diff --git a/package.json b/package.json index 28b464f..307b630 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodequent", - "version": "1.0.5", + "version": "1.0.6", "description": "Laravel Eloquent for Node.js", "main": "dist/index.js", "scripts": { diff --git a/src/Collection.ts b/src/Collection.ts index eb3a98e..e6446f3 100644 --- a/src/Collection.ts +++ b/src/Collection.ts @@ -69,4 +69,86 @@ export class Collection extends Array { } } + /** + * Convert the collection to an array. + * @returns The collection as an array + * @since 1.0.6 + */ + public toArray(): any[] { + const arr = []; + for (let i = 0; i < this.length; i++) { + if (this[i] instanceof Model) + arr.push(this[i].toArray()); + else + arr.push(this[i]); + } + + return arr; + } + + /** + * Call a function on each item in the collection. + * @param callback The function to call + * @returns void + * @since 1.0.6 + */ + public each(callback: (value: any, index: number) => void): void { + this.forEach(callback); + } + + /** + * Merge another collection into this collection and return a new collection. + * @param collection The collection to merge + * @returns void + * @since 1.0.6 + */ + public merge(collection: Collection): Collection { + return new Collection([...this, ...collection]); + } + + /** + * Get the sum of all items in the collection. + * @returns The sum of all items + * @since 1.0.6 + */ + public sum(): number { + return this.reduce((acc, val) => acc + val, 0); + } + + /** + * Get the average of all items in the collection. + * @returns The average of all items + * @since 1.0.6 + */ + public avg(): number { + return this.sum() / this.length; + } + + /** + * Get the max value in the collection. + * @returns The max value + * @since 1.0.6 + */ + public max(): number { + return Math.max(...this); + } + + /** + * Get the min value in the collection. + * @returns The min value + * @since 1.0.6 + */ + public min(): number { + return Math.min(...this); + } + + /** + * Pluck a specific attribute from the collection. + * @param $attribute The attribute to pluck + * @returns Collection + * @since 1.0.6 + */ + public pluck($attribute: string) { + return this.map((item) => item[$attribute]); + } } \ No newline at end of file