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

ezobjects

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezobjects - npm Package Compare versions

Comparing version 2.5.3 to 2.5.4

5

example-readme.js

@@ -43,3 +43,3 @@ const ezobjects = require('./index');

* Create the DatabaseRecord object -- Note: This object is not
* linked to a MySQL table directory, and therefore has no tableName
* linked to a MySQL table directory, and therefore has no `tableName`
* property, but it has the MySQL configuration properties on `id`

@@ -62,3 +62,2 @@ * because it will be extended by another object that is linked to

extendsConfig: configDatabaseRecord,
stringSearchField: 'username',
properties: [

@@ -162,2 +161,2 @@ {

}
})();
})();

2

generate-docs.js
const docket = require('docket-parser');
docket.title(`EZ Objects v2.5.3`);
docket.title(`EZ Objects v2.5.4`);
docket.linkClass('text-success');
docket.parseFiles(['index.js', 'mysql-connection.js']);
docket.generateDocs('docs');
{
"name": "ezobjects",
"version": "2.5.3",
"version": "2.5.4",
"description": "Easy dynamic object generation with optional MySQL table linking",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# EZ Objects v2.5.3
# EZ Objects v2.5.4

@@ -35,2 +35,36 @@ EZ Objects is a Node.js module (that can also be usefully browserify'd) that aims to save you lots of time

## Extending the Basic Example
```javascript
ezobjects.createObject({
className: 'User',
extends: DatabaseRecord,
properties: [
{ name: 'username', type: 'string' },
{ name: 'firstName', type: 'string' },
{ name: 'lastName', type: 'string' },
{ name: 'checkingBalance', type: 'number', setTransform: x => parseFloat(x) },
{ name: 'permissions', type: 'Array' },
{ name: 'favoriteDay', type: 'Date' }
]
});
const user = new User();
console.log(user);
```
### Expected Output
```
User {
_id: 0,
_username: '',
_firstName: '',
_lastName: '',
_checkingBalance: 0,
_permissions: [],
_favoriteDay: null }
```
## MySQL Example w/ Extended Object

@@ -237,11 +271,11 @@

### new MyObject([data])
* **Parameters:** data - `PlainObject` - (optional)
* **Parameter:** data - `PlainObject` - (optional)
* **Description:** Create a new MyObject object and initialize it using either defaults or any provided key/value pairs in the plain object `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() and then JSON.parse() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
### new MyObject([data])
* **Parameters:** data - `string` - (optional)
* **Parameter:** data - `string` - (optional)
* **Description:** Create a new MyObject object and initialize it using either defaults or any provided key/value pairs in the JSON encoded string `data`. Keys can either be equal to the name of a property, or they can be have an underscore before the name of a property, as would be the case if you were to JSON.stringify() an EZ Object. This allows for easy transferability in cases where JSON is used as the transfer medium.
### MyObject.init([data])
* **Parameters:** data - `PlainObject`
* **Parameter:** data - `PlainObject`
* **Description:** Initialize this object using either defaults or any provided key/value pairs in the plain object `data`. This is also the method used by the constructor.

@@ -257,3 +291,3 @@

### MyObject.myProperty(value)
* **Parameters:** value - `mixed`
* **Parameter:** value - `mixed`
* **Throws:** `TypeError` if `value` is not of the correct javascript data type for myProperty

@@ -269,21 +303,21 @@ * **Returns:** this

### MyObject.delete(db)
* **Parameters:** db - `MySQLConnection`
* **Parameter:** db - `MySQLConnection`
* **Description:** Delete the record in database `db`, table `tableName`, that has its `id` field equal to the `id` property of this object.
### MyObject.insert(db)
* **Parameters:** db - `MySQLConnection`
* **Parameter:** db - `MySQLConnection`
* **Description:** Insert this object's property values into the database `db`, table `tableName`, and store the resulting insertId in the `id` property of this object.
### MyObject.load(db, id)
* **Parameters:** db - `MySQLConnection`
* **Parameters:** id number The value of the `id` property of the record you wish to load
* **Parameter:** db - `MySQLConnection`
* **Parameter:** id number The value of the `id` property of the record you wish to load
* **Description:** Load the record in database `db`, table `tableName`, that has its `id` field equal to provided `id` parameter.
### MyObject.load(db, fieldValue)
* **Parameters:** db - `MySQLConnection`
* **Parameters:** fieldValue - `mixed` - The value of the `stringSearchField` property of the record you wish to load
* **Parameter:** db - `MySQLConnection`
* **Parameter:** fieldValue - `mixed` - The value of the `stringSearchField` property of the record you wish to load
* **Description:** Load the record in database `db`, table `tableName`, that has its `stringSearchField` field equal to provided `fieldValue` parameter. Here, the actual field name of `stringSearchField` is provided in the object configuration, see the configuration section below.
### MyObject.load(url)
* **Parameters:** url - `string` - The URL of a back-end that provides JSON data compatible with this object's initializer
* **Parameter:** url - `string` - The URL of a back-end that provides JSON data compatible with this object's initializer
* **Description:** Load the JSON-encoded data obtained from `url` using this object's initializer.

@@ -293,3 +327,3 @@ * **Note:** This signature is useful only when your classes are standalone browserify'd and requires you to implement a backend at `url` that will output the JSON. This signature also requires you have jQuery loaded prior to use.

### MyObject.update(db)
* **Parameters:** db - `MySQLConnection`
* **Parameter:** db - `MySQLConnection`
* **Description:** Update the record in database `db`, table `tableName`, with its `id` field equal to the `id` property of this object, using this object's property values.

@@ -296,0 +330,0 @@

Sorry, the diff of this file is not supported yet

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