Choose clear, consistent, and accurate identifiers that precisely reflect behavior and follow established patterns. This applies to function names, method names, variable types, and enum values.
For functions and methods:
"fail"
in IDLOperation::call
to match the prototype table registration)getIndex
instead of getDirectIndex
when properties might be getters)isInt32AsAnyInt
instead of isUInt32()
when the method handles multiple input formatsFor types and constants:
int64_t
over long long
) for better portabilityutf16
to match Node.js’s napi_get_value_string_utf16
)Consistent and precise naming reduces bugs from misinterpreting an identifier’s purpose, improves code readability, and makes integration with other libraries more intuitive.
Enter the URL of a public GitHub repository