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

structurae

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

structurae - npm Package Compare versions

Comparing version 1.7.4 to 1.7.5

7

CHANGELOG.md

@@ -7,2 +7,9 @@ # Changelog

## [1.7.5] - 2019-09-22
### Added
- Add BitFieldMixin
### Fixed
- Avoid BigInts in RecordArray if not supported
## [1.7.4] - 2019-09-21

@@ -9,0 +16,0 @@ ### Added

25

index.d.ts

@@ -117,2 +117,14 @@ // Type definitions for structurae

value: AnyNumber;
static fields: (Field|FieldName)[];
static size: number;
static masks: Masks;
static offsets: Masks;
static isInitialized: boolean;
static isBigInt: boolean;
static isSafe: boolean;
static zero: 0 | 0n;
static one: 1 | 1n;
static two: 2 | 2n;
static mask: AnyNumber;
constructor(data?: AnyNumber|number[]);

@@ -132,15 +144,6 @@ get(field: FieldName): number;

static getMatcher(matcher: UnpackedInt): Matcher;
static fields: (Field|FieldName)[];
static size: number;
static masks: Masks;
static offsets: Masks;
static isInitialized: boolean;
static isBigInt: boolean;
static isSafe: boolean;
static zero: 0 | 0n;
static one: 1 | 1n;
static two: 2 | 2n;
static mask: AnyNumber;
}
export declare function BitFieldMixin(fields: (Field|FieldName)[], BitFieldClass?: typeof BitField): typeof BitField;
type CompareResult = 1 | -1 | 0;

@@ -147,0 +150,0 @@

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

const BitField = require('./lib/bit-field');
const { BitField, BitFieldMixin } = require('./lib/bit-field');
const GraphMixin = require('./lib/graph');

@@ -39,2 +39,3 @@ const GridMixin = require('./lib/grid');

BitField,
BitFieldMixin,
GraphMixin,

@@ -41,0 +42,0 @@ GridMixin,

@@ -374,3 +374,3 @@ /**

// determine total size and if BigInts are required
const totalSize = this.fields.reduce((result, field) => result += (field.size || 1), 0);
const totalSize = this.fields.reduce((result, field) => (result + (field.size || 1)), 0);
const isBigInt = totalSize > BITWISE_SIZE;

@@ -489,2 +489,19 @@ const [zero, one, two] = isBigInt ? [BigInt(0), BigInt(1), BigInt(2)] : [0, 1, 2];

module.exports = BitField;
/**
* Creates a BitField class with given fields.
*
* @param {Array<Field|FieldName>} fields the schema to use for the class
* @param {Class<BitField>} [BitFieldClass] an optional BitField class to extend
* @returns {Class<BitField>}
*/
function BitFieldMixin(fields, BitFieldClass = BitField) {
class Base extends BitFieldClass {}
Base.fields = fields;
Base.initialize();
return Base;
}
module.exports = {
BitField,
BitFieldMixin,
};

@@ -60,10 +60,13 @@ const utilities = require('./utilities');

Float64Array,
BigInt64Array,
BigUint64Array,
};
if (typeof BigInt64Array === 'function') {
typedArrays.BigInt64Array = BigInt64Array;
typedArrays.BigUint64Array = BigUint64Array;
}
/**
* Extends DataView to use ArrayBuffer as an array of records or C-like structs.
*
* @deprecated
* @deprecated Use ObjectView & ArrayView instead
* @extends DataView

@@ -70,0 +73,0 @@ */

@@ -37,3 +37,3 @@ const SortedMixin = require('./sorted-collection');

if (!m) return super.push(...elements.sort(compare));
const toAdd = this.unique ? elements.filter(el => !~this.indexOf(el)) : elements;
const toAdd = this.unique ? elements.filter((el) => !~this.indexOf(el)) : elements;
const n = toAdd.length;

@@ -40,0 +40,0 @@ if (!n) return m;

{
"name": "structurae",
"version": "1.7.4",
"version": "1.7.5",
"description": "Data structures for performance-sensitive modern JavaScript applications.",

@@ -24,3 +24,2 @@ "main": "index.js",

"lint": "eslint ./lib/*.js ./test/*.js",
"coverage:report": "cat ./coverage/lcov.info | codecov",
"doc:api": "jsdoc2md > doc/API.md",

@@ -51,3 +50,2 @@ "benchmark": "node bench/index.js"

"benchmark": "^2.1.4",
"codecov": "^3.6.1",
"eslint": "^6.4.0",

@@ -71,3 +69,11 @@ "eslint-config-airbnb-base": "^14.0.0",

"lcov"
]
],
"coverageThreshold": {
"global": {
"branches": 95,
"functions": 100,
"lines": 100,
"statements": 100
}
}
},

@@ -74,0 +80,0 @@ "engines": {

# Structurae
[![npm](https://img.shields.io/npm/v/structurae.svg?style=flat-square)](https://www.npmjs.com/package/structurae)
[![Travis branch](https://img.shields.io/travis/zandaqo/structurae.svg?style=flat-square)](https://travis-ci.org/zandaqo/structurae)
[![Codecov](https://img.shields.io/codecov/c/github/zandaqo/structurae.svg?style=flat-square)](https://codecov.io/github/zandaqo/structurae)
[![Actions Status](https://github.com/zandaqo/structurae/workflows/Build/badge.svg)](https://github.com/zandaqo/structurae/actions)

@@ -7,0 +6,0 @@ A collection of data structures for high-performance JavaScript applications that includes:

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