Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
data-struct
Advanced tools
Convert between JS object and Node.js buffer with rigidly predetermined scheme.
npm install data-struct
require("data-struct")
exports just 3 namespaces:
DataTypes
– dictonary of supported types:
DataReader(buffer, scheme)
– buffer -> object function.DataWriter(object, scheme)
– object -> buffer function.
var DataTypes = require("data-struct").DataTypes;
var DataReader = require("data-struct").DataReader;
var DataWriter = require("data-struct").DataWriter;
var hero = {
id: 9,
name: 'CirnoBaka',
hp: 146,
skills: [
{
id: 34,
description: 'freezing frogs'
},
{
id: 16,
description: 'perfect math'
}
],
playable: false,
experience: 99999999,
position: {
x: 2,
y: 3
}
};
var heroScheme = {
id: DataTypes.uint32,
name: DataTypes.string,
hp: DataTypes.int16,
skills: [{
id: DataTypes.uint16,
description: DataTypes.string
}],
playable: DataTypes.boolean,
experience: DataTypes.uint32,
position: {
x: DataTypes.uint16,
y: DataTypes.uint16
}
};
var heroBuf = DataWriter(hero, heroScheme);
var heroClone = DataReader(heroBuf, heroScheme);
//nested arrays
var map = [
[0,1,0,0,1,1,1,1],
[1,1,0,0,0,1,1,1],
[1,1,0,0,0,0,1,1],
[1,1,1,1,0,0,1,1],
[0,1,1,0,0,0,1,1],
[0,0,0,0,0,1,1,1],
[0,0,0,0,1,1,1,1]
];
var mapScheme = [[DataTypes.uint8]];
var mapBuf = DataWriter(map, mapScheme);
var mapClone = DataReader(mapBuf, mapScheme);
MIT
FAQs
Convert between JS object and Node.js buffer
The npm package data-struct receives a total of 0 weekly downloads. As such, data-struct popularity was classified as not popular.
We found that data-struct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.