mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
610 B
34 lines
610 B
'use strict';
|
|
|
|
// Class names, numeric indices must match duk_hobject.h class numbers.
|
|
const classNames = [
|
|
'Unused',
|
|
'Object',
|
|
'Array',
|
|
'Function',
|
|
'Arguments',
|
|
'Boolean',
|
|
'Date',
|
|
'Error',
|
|
'JSON',
|
|
'Math',
|
|
'Number',
|
|
'RegExp',
|
|
'String',
|
|
'global',
|
|
'Symbol',
|
|
'ObjEnv',
|
|
'DecEnv',
|
|
'Pointer',
|
|
'Thread'
|
|
// Remaining class names are not currently needed.
|
|
];
|
|
const classToNum = {};
|
|
classNames.forEach((n, idx) =>{
|
|
classToNum[n] = idx;
|
|
});
|
|
|
|
function classToNumber(x) {
|
|
return classToNum[x];
|
|
}
|
|
exports.classToNumber = classToNumber;
|
|
|