@speckle/objectloader2
Version:
This is an updated objectloader for the Speckle viewer written in typescript
39 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBase = isBase;
exports.isReference = isReference;
exports.isScalar = isScalar;
exports.take = take;
function isBase(maybeBase) {
return (maybeBase !== null &&
typeof maybeBase === 'object' &&
'id' in maybeBase &&
typeof maybeBase.id === 'string');
}
function isReference(maybeRef) {
return (maybeRef !== null &&
typeof maybeRef === 'object' &&
'referencedId' in maybeRef &&
typeof maybeRef.referencedId === 'string');
}
function isScalar(value) {
const type = typeof value;
return (value === null ||
type === 'string' ||
type === 'number' ||
type === 'boolean' ||
type === 'bigint' ||
type === 'symbol' ||
type === 'undefined');
}
function take(it, count) {
const result = [];
for (let i = 0; i < count; i++) {
const itr = it.next();
if (itr.done)
break;
result.push(itr.value);
}
return result;
}
//# sourceMappingURL=types.js.map