New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

manyfest

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

manyfest - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

source/Manyfest-HashTranslation.js

2

.config/configstore/update-notifier-npm.json
{
"optOut": false,
"lastUpdateCheck": 1665680610935
"lastUpdateCheck": 1665932798321
}
{
"name": "manyfest",
"version": "1.0.3",
"version": "1.0.4",
"description": "JSON Object Manifest for Data Description and Parsing",

@@ -5,0 +5,0 @@ "main": "source/Manyfest.js",

@@ -78,2 +78,3 @@ # Manyfest

Address | The address where that data lies in the object.
Hash | A unique within this scope string-based key for this element. Used for easy access of data.
Descriptor | A description of an element including data such as Name, NameShort, Hash, Description, and other important properties.

@@ -83,5 +84,6 @@ Name | The name of the element. Meant to be the most succinct human readable name possible.

Description | A description for the element. Very useful when consuming other APIs with their own terse naming standards (or no naming standards)!
Hash | A unique within this scope string-based key for this element. Used for easy access of data.
Required | Set to true if this element is required.
Okay so these are a lot of crazy words. The important two are *Address* and *Hash*. Every element in a schema must have an address. Having a hash just multiplies the usefulness of these addresses.
## A More Advanced Schema Example

@@ -210,2 +212,6 @@

## Hash Translation Tables
Sometimes we want to reuse the structure of a schema, but look up values by hash using translations.
## Programmatically Defining a Schema

@@ -212,0 +218,0 @@

@@ -30,4 +30,4 @@ /**

// Wire in logging
this.logInfo = (typeof(pInfoLog) === 'function') ? pInfoLog : libSimpleLog;
this.logError = (typeof(pErrorLog) === 'function') ? pErrorLog : libSimpleLog;
this.logInfo = (typeof(pInfoLog) == 'function') ? pInfoLog : libSimpleLog;
this.logError = (typeof(pErrorLog) == 'function') ? pErrorLog : libSimpleLog;
}

@@ -71,5 +71,5 @@

// Make sure pObject is an object
if (!typeof(pObject) === 'object') return false;
if (typeof(pObject) != 'object') return false;
// Make sure pAddress is a string
if (!typeof(pAddress) === 'string') return false;
if (typeof(pAddress) != 'string') return false;

@@ -80,3 +80,3 @@ // TODO: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]

// This is the terminal address string (no more dots so the RECUSION ENDS IN HERE somehow)
if (tmpSeparatorIndex === -1)
if (tmpSeparatorIndex == -1)
{

@@ -246,5 +246,5 @@ // Check if the address refers to a boxed property

// Make sure pObject is an object
if (!typeof(pObject) === 'object') return undefined;
if (typeof(pObject) != 'object') return undefined;
// Make sure pAddress is a string
if (!typeof(pAddress) === 'string') return undefined;
if (typeof(pAddress) != 'string') return undefined;

@@ -255,3 +255,3 @@ // TODO: Make this work for things like SomeRootObject.Metadata["Some.People.Use.Bad.Object.Property.Names"]

// This is the terminal address string (no more dots so the RECUSION ENDS IN HERE somehow)
if (tmpSeparatorIndex === -1)
if (tmpSeparatorIndex == -1)
{

@@ -418,9 +418,9 @@ // Check if the address refers to a boxed property

// Make sure pObject is an object
if (!typeof(pObject) === 'object') return false;
if (typeof(pObject) != 'object') return false;
// Make sure pAddress is a string
if (!typeof(pAddress) === 'string') return false;
if (typeof(pAddress) != 'string') return false;
let tmpSeparatorIndex = pAddress.indexOf('.');
if (tmpSeparatorIndex === -1)
if (tmpSeparatorIndex == -1)
{

@@ -427,0 +427,0 @@ // Check if it's a boxed property

@@ -7,2 +7,4 @@ /**

let libObjectAddressResolver = require('./Manyfest-ObjectAddressResolver.js');
let libHashTranslation = require('./Manyfest-HashTranslation.js');
let libSchemaManipulation = require('./Manyfest-SchemaManipulation.js');

@@ -54,2 +56,6 @@ /**

}
this.schemaManipulations = new libSchemaManipulation(this.logInfo, this.logError);
this.hashTranslations = new libHashTranslation(this.logInfo, this.logError);
}

@@ -158,4 +164,2 @@

// Always add the address as a hash
// TODO: Check if this is a good idea or not.
// Collisions are bound to happen with both representations of the address/hash in here.
this.elementHashes[pAddress] = pAddress;

@@ -165,4 +169,10 @@

{
// TODO: Check if this is a good idea or not..
// Collisions are bound to happen with both representations of the address/hash in here and developers being able to create their own hashes.
this.elementHashes[pDescriptor.Hash] = pAddress;
}
else
{
pDescriptor.Hash = pAddress;
}

@@ -180,5 +190,5 @@ return true;

{
if (this.elementHashes.hasOwnProperty(pHash))
if (this.elementHashes.hasOwnProperty(pHash) || this.hashTranslations.translationTable.hasOwnProperty(pHash))
{
return this.getDescriptor(this.elementHashes[pHash]);
return this.getDescriptor(this.elementHashes[this.hashTranslations.translate(pHash)]);
}

@@ -203,5 +213,5 @@ else

{
if (this.elementHashes.hasOwnProperty(pHash))
if (this.elementHashes.hasOwnProperty(pHash) || this.hashTranslations.translationTable.hasOwnProperty(pHash))
{
return this.checkAddressExists(pObject, this.elementHashes[pHash]);
return this.checkAddressExists(pObject, this.elementHashes[this.hashTranslations.translate(pHash)]);
}

@@ -225,5 +235,5 @@ else

{
if (this.elementHashes.hasOwnProperty(pHash))
if (this.elementHashes.hasOwnProperty(pHash) || this.hashTranslations.translationTable.hasOwnProperty(pHash))
{
return this.getValueAtAddress(pObject, this.elementHashes[pHash]);
return this.getValueAtAddress(pObject, this.elementHashes[this.hashTranslations.translate(pHash)]);
}

@@ -246,5 +256,5 @@ else

{
if (this.elementHashes.hasOwnProperty(pHash))
if (this.elementHashes.hasOwnProperty(pHash) || this.hashTranslations.translationTable.hasOwnProperty(pHash))
{
return this.setValueAtAddress(pObject, this.elementHashes[pHash], pValue);
return this.setValueAtAddress(pObject, this.elementHashes[this.hashTranslations.translate(pHash)], pValue);
}

@@ -251,0 +261,0 @@ else

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

/**
* Unit tests for Meadow
* Unit tests for Manyfest
*

@@ -4,0 +4,0 @@ * @license MIT

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