'use strict'

const binding = process.atomBinding('in_app_purchase')
const v8Util = process.atomBinding('v8_util')

module.exports = {

  canMakePayments: function() {
    return binding.canMakePayments()
  },

  getReceiptURL: function() {
    return binding.getReceiptURL()
  },

  purchaseProduct: function(productID, quantity = 1, callback) {
    if (typeof productID !== 'string') {
      throw new TypeError('productID must be a string')
    }
    if (typeof quantity === 'function') {
      quantity = 1
      callback = quantity
    }
    return binding.purchaseProduct(productID, quantity, callback)
  },

  addTransactionListener: function(callback) {
    if (typeof callback !== 'function') {
      throw new TypeError('callback must be a function')
    }
    return binding.addTransactionListener(callback)
  }
}

                 // Mark standard asynchronous functions.
                 v8Util.setHiddenValue(
                     module.exports.purchaseProduct, 'asynchronous', true)
v8Util.setHiddenValue(
    module.exports.addTransactionListener, 'asynchronous', true)

@@ -148,37 +148,38 @@
 yments: function
+ 
 () %7B%0A
-
     return bindi
@@ -230,16 +230,17 @@
 function
+ 
 () %7B%0A   
@@ -304,16 +304,17 @@
 function
+ 
 (product
@@ -645,16 +645,17 @@
 function
+ 
 (callbac
@@ -823,33 +823,16 @@
 %0A  %7D%0A%7D%0A%0A
-                 
 // Mark 
@@ -864,33 +864,16 @@
 ctions.%0A
-                 
 v8Util.s
@@ -887,35 +887,16 @@
 nValue(%0A
-                   
   module
@@ -966,18 +966,16 @@
 nValue(%0A
-  
   module

Update code style