MCPcopy Index your code
hub / github.com/plotly/plotly.js / fromObject

Function fromObject

stackgl_modules/index.js:277–296  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

275 return buf;
276}
277function fromObject(obj) {
278 if (Buffer.isBuffer(obj)) {
279 var len = checked(obj.length) | 0;
280 var buf = createBuffer(len);
281 if (buf.length === 0) {
282 return buf;
283 }
284 obj.copy(buf, 0, 0, len);
285 return buf;
286 }
287 if (obj.length !== undefined) {
288 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
289 return createBuffer(0);
290 }
291 return fromArrayLike(obj);
292 }
293 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
294 return fromArrayLike(obj.data);
295 }
296}
297function checked(length) {
298 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
299 // length is NaN (which is otherwise coerced to zero.)

Callers 1

fromFunction · 0.85

Calls 4

checkedFunction · 0.85
createBufferFunction · 0.85
numberIsNaNFunction · 0.85
fromArrayLikeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…