Skip to content

Commit

Permalink
BREAKING CHANGE:rename the method name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lalji Kanjareeya committed Oct 10, 2019
1 parent 20cccb0 commit b218883
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,12 @@ class Datastore extends DatastoreRequest {
return Datastore.isKey(value);
}

keyToLegacyUrlsafe(key: entity.Key, locationPrefix?: string): Promise<string>;
keyToLegacyUrlsafe(
keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise<string>;
keyToLegacyUrlSafe(
key: entity.Key,
callback: KeyToLegacyUrlSafeCallback
): void;
keyToLegacyUrlsafe(
keyToLegacyUrlSafe(
key: entity.Key,
locationPrefix: string,
callback: KeyToLegacyUrlSafeCallback
Expand Down Expand Up @@ -764,7 +764,7 @@ class Datastore extends DatastoreRequest {
* const datastore = new Datastore();
* const key = datastore.key(['Company', 'Google']);
*
* datastore.keyToLegacyUrlsafe(key, (err, urlSafeKey) => {
* datastore.keyToLegacyUrlSafe(key, (err, urlSafeKey) => {
* if (err) {
* // Error handling omitted.
* }
Expand All @@ -779,7 +779,7 @@ class Datastore extends DatastoreRequest {
* const key = datastore.key(['Task', 123]);
* const locationPrefix = 's~';
*
* datastore.keyToLegacyUrlsafe(key, locationPrefix, (err, urlSafeKey) => {
* datastore.keyToLegacyUrlSafe(key, locationPrefix, (err, urlSafeKey) => {
* if (err) {
* // Error handling omitted.
* }
Expand All @@ -793,10 +793,10 @@ class Datastore extends DatastoreRequest {
* const key = datastore.key(['Task', 123]);
* const locationPrefix = 's~';
*
* const urlSafeKey = await datastore.keyToLegacyUrlsafe(key, locationPrefix);
* const urlSafeKey = await datastore.keyToLegacyUrlSafe(key, locationPrefix);
* console.log(urlSafeKey);
*/
keyToLegacyUrlsafe(
keyToLegacyUrlSafe(
key: entity.Key,
locationPrefixOrCallback?: string | KeyToLegacyUrlSafeCallback,
callback?: KeyToLegacyUrlSafeCallback
Expand Down
8 changes: 4 additions & 4 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ describe('Datastore', () => {
});
});

describe('keyToLegacyUrlsafe', () => {
describe('keyToLegacyUrlSafe', () => {
it('should convert key to url safe base64 string', () => {
const key = new entity.Key({
path: ['Task', 'Test'],
Expand All @@ -635,7 +635,7 @@ describe('Datastore', () => {
(datastore.auth as any).getProjectId = (callback: Function) => {
callback(null, 'project-id');
};
datastore.keyToLegacyUrlsafe(key, (err, urlSafekey) => {
datastore.keyToLegacyUrlSafe(key, (err, urlSafekey) => {
assert.ifError(err);
assert.strictEqual(urlSafekey, base64EndocdedUrlsafeKey);
});
Expand All @@ -652,7 +652,7 @@ describe('Datastore', () => {
(datastore.auth as any).getProjectId = (callback: Function) => {
callback(null, 'project-id');
};
datastore.keyToLegacyUrlsafe(key, locationPrefix, (err, urlSafekey) => {
datastore.keyToLegacyUrlSafe(key, locationPrefix, (err, urlSafekey) => {
assert.ifError(err);
assert.strictEqual(urlSafekey, base64EndocdedUrlsafeKey);
});
Expand All @@ -664,7 +664,7 @@ describe('Datastore', () => {
(datastore.auth as any).getProjectId = (callback: Function) => {
callback(error);
};
datastore.keyToLegacyUrlsafe({} as entity.Key, (err, urlSafekey) => {
datastore.keyToLegacyUrlSafe({} as entity.Key, (err, urlSafekey) => {
assert.strictEqual(err, error);
assert.strictEqual(urlSafekey, undefined);
});
Expand Down

0 comments on commit b218883

Please sign in to comment.