mirror of https://gitee.com/cf-fz/WebCAD.git
parent
d982c0f8e4
commit
b4d441409b
@ -0,0 +1,22 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`路径简化 1`] = `
|
||||
Array [
|
||||
Vector2 {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
},
|
||||
Vector2 {
|
||||
"x": 10,
|
||||
"y": 0,
|
||||
},
|
||||
Vector2 {
|
||||
"x": 18,
|
||||
"y": 6,
|
||||
},
|
||||
Vector2 {
|
||||
"x": 28.3,
|
||||
"y": 6,
|
||||
},
|
||||
]
|
||||
`;
|
@ -1,6 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
|
||||
/**
|
||||
* ArraybufferUtils contains methods to convert from and to ArrayBuffer binary format
|
||||
*
|
@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* BufferUtils contains methods to convert from and to Node.js Buffer binary format
|
||||
*
|
||||
* @class BufferUtils
|
||||
* @module BinaryUtils
|
||||
* @static
|
||||
*/
|
||||
function BufferUtils(){}
|
||||
|
||||
/**
|
||||
* Create nodejs buffer from arraybuffer
|
||||
*
|
||||
* @method fromArrayBuffer
|
||||
* @param {Arraybuffer} array
|
||||
* @return {Buffer} buffer
|
||||
*/
|
||||
BufferUtils.fromArrayBuffer = function(array)
|
||||
{
|
||||
var buffer = new Buffer(array.byteLength);
|
||||
var view = new Uint8Array(array);
|
||||
|
||||
for(var i = 0; i < buffer.length; i++)
|
||||
{
|
||||
buffer[i] = view[i];
|
||||
}
|
||||
|
||||
return buffer;
|
||||
};
|
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* BufferUtils contains methods to convert from and to Node.js Buffer binary format
|
||||
*
|
||||
* @class BufferUtils
|
||||
* @module BinaryUtils
|
||||
* @static
|
||||
*/
|
||||
export class BufferUtils
|
||||
{
|
||||
/**
|
||||
* Create nodejs buffer from arraybuffer
|
||||
*
|
||||
* @method fromArrayBuffer
|
||||
* @param {Arraybuffer} array
|
||||
* @return {Buffer} buffer
|
||||
*/
|
||||
static fromArrayBuffer = array =>
|
||||
{
|
||||
const buffer = new Buffer(array.byteLength);
|
||||
const view = new Uint8Array(array);
|
||||
|
||||
for (let i = 0; i < buffer.length; i++)
|
||||
{
|
||||
buffer[i] = view[i];
|
||||
}
|
||||
|
||||
return buffer;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in new issue