Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit c706745

Browse files
DahadenDave
andauthored
Added optional to args that get and set (#174)
Co-authored-by: Dave <[email protected]>
1 parent d52c5e4 commit c706745

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

lib/analytics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ Analytics.prototype.addDestinationMiddleware = function(
158158
*/
159159

160160
Analytics.prototype.init = Analytics.prototype.initialize = function(
161-
settings: IntegrationsSettings,
162-
options: InitOptions
161+
settings?: IntegrationsSettings,
162+
options?: InitOptions
163163
): SegmentAnalytics {
164164
settings = settings || {};
165165
options = options || {};

lib/cookie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Cookie(options?: CookieOptions) {
2727
* Get or set the cookie options.
2828
*/
2929

30-
Cookie.prototype.options = function(options: CookieOptions) {
30+
Cookie.prototype.options = function(options?: CookieOptions) {
3131
if (arguments.length === 0) return this._options;
3232

3333
options = options || {};

lib/entity.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Entity.prototype.storage = function() {
7272
* Get or set storage `options`.
7373
*/
7474

75-
Entity.prototype.options = function(options: InitOptions) {
75+
Entity.prototype.options = function(options?: InitOptions) {
7676
if (arguments.length === 0) return this._options;
7777
this._options = defaults(options || {}, this.defaults || {});
7878
};
@@ -81,7 +81,7 @@ Entity.prototype.options = function(options: InitOptions) {
8181
* Get or set the entity's `id`.
8282
*/
8383

84-
Entity.prototype.id = function(id: string): string | undefined {
84+
Entity.prototype.id = function(id?: string): string | undefined {
8585
switch (arguments.length) {
8686
case 0:
8787
return this._getId();
@@ -177,7 +177,7 @@ Entity.prototype._setIdInLocalStorage = function(id: string) {
177177
*/
178178

179179
Entity.prototype.properties = Entity.prototype.traits = function(
180-
traits: object
180+
traits?: object
181181
): object | undefined {
182182
switch (arguments.length) {
183183
case 0:
@@ -219,7 +219,7 @@ Entity.prototype._setTraits = function(traits: object) {
219219
* extend the existing `traits` instead of overwriting.
220220
*/
221221

222-
Entity.prototype.identify = function(id: string, traits: object) {
222+
Entity.prototype.identify = function(id?: string, traits?: object) {
223223
traits = traits || {};
224224
var current = this.id();
225225
if (current === null || current === id)

lib/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Metrics(options?: MetricsOptions) {
1414
* Set the metrics options.
1515
*/
1616

17-
Metrics.prototype.options = function(options: MetricsOptions) {
17+
Metrics.prototype.options = function(options?: MetricsOptions) {
1818
options = options || {};
1919

2020
this.host = options.host || 'api.segment.io/v1';

lib/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Store(options?: { enabled: boolean }) {
2222
* Set the `options` for the store.
2323
*/
2424

25-
Store.prototype.options = function(options: { enabled?: boolean }) {
25+
Store.prototype.options = function(options?: { enabled?: boolean }) {
2626
if (arguments.length === 0) return this._options;
2727

2828
options = options || {};

lib/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ inherit(User, Entity);
8686
* assert.notEqual(anonymousId, user.anonymousId());
8787
*/
8888

89-
User.prototype.id = function(id: string): string | undefined {
89+
User.prototype.id = function(id?: string): string | undefined {
9090
var prev = this._getId();
9191
var ret = Entity.prototype.id.apply(this, arguments);
9292
if (prev == null) return ret;
@@ -106,7 +106,7 @@ User.prototype.id = function(id: string): string | undefined {
106106
* @return {String|User}
107107
*/
108108

109-
User.prototype.anonymousId = function(anonymousId: string): string | User {
109+
User.prototype.anonymousId = function(anonymousId?: string): string | User {
110110
var store = this.storage();
111111

112112
// set / remove

0 commit comments

Comments
 (0)