index.js
function writeJSON(filename, obj) {

    return new Promise(function (resolve, reject) {

      if (!Object.is(obj)) resolve(new Error('writeJSON requires the second argument to be an object'));

      _fs2['default'].writeFile(filename, JSON.stringify(obj, null, 2) + '\n', function (err) {
        if (err) reject(err);
        resolve(obj);
      });
    });
  }
function writeJSON(filename, obj) {

    return new Promise(function (resolve, reject) {

      if (!Object.is(obj)) resolve(new Error('writeJSON requires the second argument to be an object'));

      _fs2['default'].writeFile(filename, JSON.stringify(obj, null, 2) + '\n', function (err) {
        if (err) reject(err);
        resolve(obj);
      });
    });
  }
function writeJSON ( filename , obj ) { return new Promise ( function ( resolve , reject ) { if ( ! Object . is ( obj ) ) resolve ( new Error ( 'writeJSON requires the second argument to be an object' ) ) ; _fs2 [ 'default' ] . writeFile ( filename , JSON . stringify ( obj , null , 2 ) + '\n' , function ( err ) { if ( err ) reject ( err ) ; resolve ( obj ) ; } ) ; } ) ; }
write json file, return promise
write json file return promise