{"size": 526, "ext": "js", "max_stars_repo_path": "test/test-stringify-replacer.js", "max_stars_repo_name": "HarshithaKP/yieldable-json", "max_stars_repo_stars_event_min_datetime": "2017-11-14T12:06:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-18T22:27:36.000Z", "max_issues_repo_path": "test/test-stringify-replacer.js", "max_issues_repo_name": "HarshithaKP/yieldable-json", "max_issues_repo_issues_event_min_datetime": "2017-11-13T06:46:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-31T13:54:29.000Z", "max_forks_repo_path": "test/test-stringify-replacer.js", "max_forks_repo_name": "HarshithaKP/yieldable-json", "max_forks_repo_forks_event_min_datetime": "2017-11-13T06:25:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-14T17:44:18.000Z"}
{"max_stars_count": 118, "max_issues_count": 29, "max_forks_count": 21, "avg_line_length": 20.2307692308, "max_line_length": 62, "alphanum_fraction": 0.63878327}
'use strict';

const yj = require('../index');
const tap = require('tap');

const objData = {
  name: 'Jacqueline Poole',
  gender: 'female',
  age: 40,
};

// Replacer function which just returns non-string type values
let replacer = (key, value) => {
  if (typeof value === 'string')
    return undefined;
  return value;
};

// Make sure the API is working just with replacer function.
yj.stringifyAsync(objData, replacer, (err, strData) => {
  if (!err)
    tap.equal('{"age":40}', strData);
  else
    tap.fail(err);
});
