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 1.0.0 to 1.0.1

12

example.js

@@ -115,6 +115,16 @@ const ezobjects = require('./index');

test(arg) {
/** Getter */
if ( arg === undefined )
return this._test;
this._test = arg;
/** Setter */
else if ( typeof arg == 'string' )
this._test = arg;
/** Handle type errors */
else
throw new TypeError(`${this.constructor.name}.test(${typeof arg}): Invalid signature.`);
/** Return this object for set call chaining */
return this;
}

@@ -121,0 +131,0 @@ }

/**
* @module ezobjects
* @copyright 2018 Rich Lowe
* @license MIT
* @description Easy, automatic object creation from simple templates with strict typing
*/

@@ -23,2 +25,3 @@ module.exports = (obj) => {

/** Initializer */
init(data = {}) {

@@ -57,2 +60,3 @@ if ( typeof super.init === 'function' )

if ( col.type == 'int' ) {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -78,2 +82,3 @@ /** Getter */

else if ( col.type == 'float' ) {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -99,2 +104,3 @@ /** Getter */

else if ( col.type == 'boolean' ) {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -120,2 +126,3 @@ /** Getter */

else if ( col.type == 'string' ) {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -128,3 +135,3 @@ /** Getter */

else if ( typeof arg == 'string' )
this[`_${col.name}`] = arg.toString();
this[`_${col.name}`] = arg;

@@ -142,2 +149,3 @@ /** Handle type errors */

else if ( col.type == 'Array' ) {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -163,2 +171,3 @@ /** Getter */

else {
/** Create class method on prototype */
parent[obj.name].prototype[col.name] = function (arg) {

@@ -165,0 +174,0 @@ /** Getter */

2

package.json
{
"name": "ezobjects",
"version": "1.0.0",
"version": "1.0.1",
"description": "Easy dynamic object generation with strict typing and set chaining",

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

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

# EZ Objects v1.0.0
# EZ Objects v1.0.1

@@ -246,6 +246,16 @@ Fully operational! Please open an issue for any bug reports or feature requests.

test(arg) {
/** Getter */
if ( arg === undefined )
return this._test;
this._test = arg;
/** Setter */
else if ( typeof arg == 'string' )
this._test = arg.toString();
/** Handle type errors */
else
throw new TypeError(`${this.constructor.name}.test(${typeof arg}): Invalid signature.`);
/** Return this object for set call chaining */
return this;
}

@@ -252,0 +262,0 @@ }

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