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

construct-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

construct-js - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/index.d.ts

@@ -27,3 +27,3 @@ export declare enum Endian {

private fields;
private allFieldNames;
private fieldMap;
name: string;

@@ -30,0 +30,0 @@ constructor(name: string, alignment?: StructAlignment, paddingDirection?: AlignmentPadding);

@@ -40,3 +40,3 @@ "use strict";

this.fields = [];
this.allFieldNames = [];
this.fieldMap = {};
this.name = name;

@@ -47,4 +47,4 @@ this.alignment = alignment;

get(name) {
assert(this.allFieldNames.includes(name), `No field with name ${name} exists on Struct ${this.name}`);
return this.fields.find(f => f.name === name).field;
assert((name in this.fieldMap), `No field with name ${name} exists on Struct ${this.name}`);
return this.fieldMap[name].field;
}

@@ -73,3 +73,3 @@ getDeep(path) {

getOffset(name) {
assert(this.allFieldNames.includes(name), `No field with name ${name} exists on Struct ${this.name}`);
assert((name in this.fieldMap), `No field with name ${name} exists on Struct ${this.name}`);
let total = 0;

@@ -88,6 +88,7 @@ for (let { name: fName, field } of this.fields) {

field(name, item) {
assert(!this.allFieldNames.includes(name), `A field already exists on Struct ${this.name} with name ${name}`);
assert(!(name in this.fieldMap), `A field already exists on Struct ${this.name} with name ${name}`);
assert(validNameRegex.test(name), `Name "${name}" is not valid. Names can be made of letters, numbers, underscores, and dashes`);
this.fields.push({ name, field: item });
this.allFieldNames.push(name);
const field = { name, field: item };
this.fields.push(field);
this.fieldMap[name] = field;
return this;

@@ -94,0 +95,0 @@ }

{
"name": "construct-js",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

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

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