mirror: rename helper `_primitivesTableName` (#861)

Summary:
Some clients want to write

    const primitivesTableName = _primitivesTableName(typename);

which they cannot if the function is also called `primitivesTableName`,
due to ECMAScript shadowing semantics.

Test Plan:
Running `yarn flow` suffices; running `yarn unit` really suffices.

wchargin-branch: mirror-rename-primitivestablename
This commit is contained in:
William Chargin 2018-09-19 14:28:26 -07:00 committed by GitHub
parent 1d18652459
commit 5debae414e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -237,7 +237,7 @@ export class Mirror {
throw new Error("invalid field name: " + JSON.stringify(fieldname)); throw new Error("invalid field name: " + JSON.stringify(fieldname));
} }
} }
const tableName = primitivesTableName(typename); const tableName = _primitivesTableName(typename);
const tableSpec = [ const tableSpec = [
"id TEXT NOT NULL PRIMARY KEY", "id TEXT NOT NULL PRIMARY KEY",
...type.primitiveFieldNames.map((fieldname) => `"${fieldname}"`), ...type.primitiveFieldNames.map((fieldname) => `"${fieldname}"`),
@ -402,7 +402,7 @@ function isSqlSafe(token: string) {
* *
* Note that the resulting string is double-quoted. * Note that the resulting string is double-quoted.
*/ */
function primitivesTableName(typename: Schema.Typename) { function _primitivesTableName(typename: Schema.Typename) {
// istanbul ignore if // istanbul ignore if
if (!isSqlSafe(typename)) { if (!isSqlSafe(typename)) {
// This shouldn't be reachable---we should have caught it earlier. // This shouldn't be reachable---we should have caught it earlier.