code:
// Generated by CoffeeScript 1.12.4
var YAML, examplePath, ref, url;

if (typeof YAML === "undefined" || YAML === null) {
  YAML = require('../../src/Yaml');
}

describe('Parsed YAML Collections', function() {
  it('can be simple sequence', function() {
    return expect(YAML.parse("- apple\n- banana\n- carrot")).toEqual(['apple', 'banana', 'carrot']);
  });
  it('can be nested sequences', function() {
    return expect(YAML.parse("-\n - foo\n - bar\n - baz")).toEqual([['foo', 'bar', 'baz']]);
  });
  it('can be mixed sequences', function() {
    return expect(YAML.parse("- apple\n-\n - foo\n - bar\n - x123\n- banana\n- carrot")).toEqual(['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot']);
  });
  it('can be deeply nested sequences', function() {
    return expect(YAML.parse("-\n -\n  - uno\n  - dos")).toEqual([[['uno', 'dos']]]);
  });
  it('can be simple mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar: stuff")).toEqual({
      foo: 'whatever',
      bar: 'stuff'
    });
  });
  it('can be sequence in a mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n - uno\n - dos")).toEqual({
      foo: 'whatever',
      bar: ['uno', 'dos']
    });
  });
  it('can be nested mappings', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n fruit: apple\n name: steve\n sport: baseball")).toEqual({
      foo: 'whatever',
      bar: {
        fruit: 'apple',
        name: 'steve',
        sport: 'baseball'
      }
    });
  });
  it('can be mixed mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n -\n   fruit: apple\n   name: steve\n   sport: baseball\n - more\n -\n   python: rocks\n   perl: papers\n   ruby: scissorses")).toEqual({
      foo: 'whatever',
      bar: [
        {
          fruit: 'apple',
          name: 'steve',
          sport: 'baseball'
        }, 'more', {
          python: 'rocks',
          perl: 'papers',
          ruby: 'scissorses'
        }
      ]
    });
  });
  it('can have mapping-in-sequence shortcut', function() {
    return expect(YAML.parse("- work on YAML.py:\n   - work on Store")).toEqual([
      {
        'work on YAML.py': ['work on Store']
      }
    ]);
  });
  it('can have unindented sequence-in-mapping shortcut', function() {
    return expect(YAML.parse("allow:\n- 'localhost'\n- '%.sourceforge.net'\n- '%.freepan.org'")).toEqual({
      allow: ['localhost', '%.sourceforge.net', '%.freepan.org']
    });
  });
  it('can merge key', function() {
    return expect(YAML.parse("mapping:\n  name: Joe\n  job: Accountant\n  <<:\n    age: 38")).toEqual({
      mapping: {
        name: 'Joe',
        job: 'Accountant',
        age: 38
      }
    });
  });
  return it('can ignore trailing empty lines for smallest indent', function() {
    return expect(YAML.parse(" trailing: empty lines\n")).toEqual({
      trailing: 'empty lines'
    });
  });
});

describe('Parsed YAML Inline Collections', function() {
  it('can be simple inline array', function() {
    return expect(YAML.parse("---\nseq: [ a, b, c ]")).toEqual({
      seq: ['a', 'b', 'c']
    });
  });
  it('can be simple inline hash', function() {
    return expect(YAML.parse("---\nhash: { name: Steve, foo: bar }")).toEqual({
      hash: {
        name: 'Steve',
        foo: 'bar'
      }
    });
  });
  it('can be nested inline hash', function() {
    return expect(YAML.parse("---\nhash: { val1: \"string\", val2: { v2k1: \"v2k1v\" } }")).toEqual({
      hash: {
        val1: 'string',
        val2: {
          v2k1: 'v2k1v'
        }
      }
    });
  });
  return it('can be multi-line inline collections', function() {
    return expect(YAML.parse("languages: [ Ruby,\n             Perl,\n             Python ]\nwebsites: { YAML: yaml.org,\n            Ruby: ruby-lang.org,\n            Python: python.org,\n            Perl: use.perl.org }")).toEqual({
      languages: ['Ruby', 'Perl', 'Python'],
      websites: {
        YAML: 'yaml.org',
        Ruby: 'ruby-lang.org',
        Python: 'python.org',
        Perl: 'use.perl.org'
      }
    });
  });
});

describe('Parsed YAML Basic Types', function() {
  it('can be strings', function() {
    return expect(YAML.parse("---\nString")).toEqual('String');
  });
  it('can be double-quoted strings with backslashes', function() {
    return expect(YAML.parse("str:\n    \"string with \\\\ inside\"")).toEqual({
      str: 'string with \\ inside'
    });
  });
  it('can be single-quoted strings with backslashes', function() {
    return expect(YAML.parse("str:\n    'string with \\\\ inside'")).toEqual({
      str: 'string with \\\\ inside'
    });
  });
  it('can be double-quoted strings with line breaks', function() {
    return expect(YAML.parse("str:\n    \"string with \\n inside\"")).toEqual({
      str: 'string with \n inside'
    });
  });
  it('can be single-quoted strings with escaped line breaks', function() {
    return expect(YAML.parse("str:\n    'string with \\n inside'")).toEqual({
      str: 'string with \\n inside'
    });
  });
  it('can be double-quoted strings with line breaks and backslashes', function() {
    return expect(YAML.parse("str:\n    \"string with \\n inside and \\\\ also\"")).toEqual({
      str: 'string with \n inside and \\ also'
    });
  });
  it('can be single-quoted strings with line breaks and backslashes', function() {
    return expect(YAML.parse("str:\n    'string with \\n inside and \\\\ also'")).toEqual({
      str: 'string with \\n inside and \\\\ also'
    });
  });
  it('can have string characters in sequences', function() {
    return expect(YAML.parse("- What's Yaml?\n- It's for writing data structures in plain text.\n- And?\n- And what? That's not good enough for you?\n- No, I mean, \"And what about Yaml?\"\n- Oh, oh yeah. Uh.. Yaml for JavaScript.")).toEqual(["What's Yaml?", "It's for writing data structures in plain text.", "And?", "And what? That's not good enough for you?", "No, I mean, \"And what about Yaml?\"", "Oh, oh yeah. Uh.. Yaml for JavaScript."]);
  });
  it('can have indicators in strings', function() {
    return expect(YAML.parse("the colon followed by space is an indicator: but is a string:right here\nsame for the pound sign: here we have it#in a string\nthe comma can, honestly, be used in most cases: [ but not in, inline collections ]")).toEqual({
      'the colon followed by space is an indicator': 'but is a string:right here',
      'same for the pound sign': 'here we have it#in a string',
      'the comma can, honestly, be used in most cases': ['but not in', 'inline collections']
    });
  });
  it('can force strings', function() {
    return expect(YAML.parse("date string: !str 2001-08-01\nnumber string: !str 192\ndate string 2: !!str 2001-08-01\nnumber string 2: !!str 192")).toEqual({
      'date string': '2001-08-01',
      'number string': '192',
      'date string 2': '2001-08-01',
      'number string 2': '192'
    });
  });
  it('can be single-quoted strings', function() {
    return expect(YAML.parse("all my favorite symbols: '#:!/%.)'\na few i hate: '&(*'\nwhy do i hate them?: 'it''s very hard to explain'")).toEqual({
      'all my favorite symbols': '#:!/%.)',
      'a few i hate': '&(*',
      'why do i hate them?': 'it\'s very hard to explain'
    });
  });
  it('can be double-quoted strings', function() {
    return expect(YAML.parse("i know where i want my line breaks: \"one here\\nand another here\\n\"")).toEqual({
      'i know where i want my line breaks': "one here\nand another here\n"
    });
  });
  it('can be null', function() {
    return expect(YAML.parse("name: Mr. Show\nhosted by: Bob and David\ndate of next season: ~")).toEqual({
      'name': 'Mr. Show',
      'hosted by': 'Bob and David',
      'date of next season': null
    });
  });
  it('can be boolean', function() {
    return expect(YAML.parse("Is Gus a Liar?: true\nDo I rely on Gus for Sustenance?: false")).toEqual({
      'Is Gus a Liar?': true,
      'Do I rely on Gus for Sustenance?': false
    });
  });
  it('can be integers', function() {
    return expect(YAML.parse("zero: 0\nsimple: 12\none-thousand: 1,000\nnegative one-thousand: -1,000")).toEqual({
      'zero': 0,
      'simple': 12,
      'one-thousand': 1000,
      'negative one-thousand': -1000
    });
  });
  it('can be integers as map keys', function() {
    return expect(YAML.parse("1: one\n2: two\n3: three")).toEqual({
      1: 'one',
      2: 'two',
      3: 'three'
    });
  });
  it('can be floats', function() {
    return expect(YAML.parse("a simple float: 2.00\nlarger float: 1,000.09\nscientific notation: 1.00009e+3")).toEqual({
      'a simple float': 2.0,
      'larger float': 1000.09,
      'scientific notation': 1000.09
    });
  });
  it('can be time', function() {
    var iso8601Date, spaceSeparatedDate, withDatesToTime;
    iso8601Date = new Date(Date.UTC(2001, 12 - 1, 14, 21, 59, 43, 10));
    iso8601Date.setTime(iso8601Date.getTime() - 5 * 3600 * 1000);
    spaceSeparatedDate = new Date(Date.UTC(2001, 12 - 1, 14, 21, 59, 43, 10));
    spaceSeparatedDate.setTime(spaceSeparatedDate.getTime() + 5 * 3600 * 1000);
    withDatesToTime = function(input) {
      var key, res, val;
      res = {};
      for (key in input) {
        val = input[key];
        res[key] = val.getTime();
      }
      return res;
    };
    return expect(withDatesToTime(YAML.parse("iso8601: 2001-12-14t21:59:43.010+05:00\nspace separated: 2001-12-14 21:59:43.010 -05:00"))).toEqual(withDatesToTime({
      'iso8601': iso8601Date,
      'space separated': spaceSeparatedDate
    }));
  });
  return it('can be date', function() {
    var aDate, withDatesToTime;
    aDate = new Date(Date.UTC(1976, 7 - 1, 31, 0, 0, 0, 0));
    withDatesToTime = function(input) {
      var key, res, val;
      return input;
      res = {};
      for (key in input) {
        val = input[key];
        res[key] = val.getTime();
      }
      return res;
    };
    return expect(withDatesToTime(YAML.parse("date: 1976-07-31"))).toEqual(withDatesToTime({
      'date': aDate
    }));
  });
});

describe('Parsed YAML Blocks', function() {
  it('can be single ending newline', function() {
    return expect(YAML.parse("---\nthis: |\n    Foo\n    Bar")).toEqual({
      'this': "Foo\nBar\n"
    });
  });
  it('can be single ending newline with \'+\' indicator', function() {
    return expect(YAML.parse("normal: |\n  extra new lines not kept\n\npreserving: |+\n  extra new lines are kept\n\n\ndummy: value")).toEqual({
      'normal': "extra new lines not kept\n",
      'preserving': "extra new lines are kept\n\n\n",
      'dummy': 'value'
    });
  });
  it('can be multi-line block handling trailing newlines in function of \'+\', \'-\' indicators', function() {
    return expect(YAML.parse("clipped: |\n    This has one newline.\n\n\n\nsame as \"clipped\" above: \"This has one newline.\\n\"\n\nstripped: |-\n    This has no newline.\n\n\n\nsame as \"stripped\" above: \"This has no newline.\"\n\nkept: |+\n    This has four newlines.\n\n\n\nsame as \"kept\" above: \"This has four newlines.\\n\\n\\n\\n\"")).toEqual({
      'clipped': "This has one newline.\n",
      'same as "clipped" above': "This has one newline.\n",
      'stripped': 'This has no newline.',
      'same as "stripped" above': 'This has no newline.',
      'kept': "This has four newlines.\n\n\n\n",
      'same as "kept" above': "This has four newlines.\n\n\n\n"
    });
  });
  it('can be folded block in a sequence', function() {
    return expect(YAML.parse("---\n- apple\n- banana\n- >\n    can't you see\n    the beauty of yaml?\n    hmm\n- dog")).toEqual(['apple', 'banana', "can't you see the beauty of yaml? hmm\n", 'dog']);
  });
  it('can be folded block as a mapping value', function() {
    return expect(YAML.parse("---\nquote: >\n    Mark McGwire's\n    year was crippled\n    by a knee injury.\nsource: espn")).toEqual({
      'quote': "Mark McGwire's year was crippled by a knee injury.\n",
      'source': 'espn'
    });
  });
  it('can be folded block handling trailing newlines in function of \'+\', \'-\' indicators', function() {
    return expect(YAML.parse("clipped: >\n    This has one newline.\n\n\n\nsame as \"clipped\" above: \"This has one newline.\\n\"\n\nstripped: >-\n    This has no newline.\n\n\n\nsame as \"stripped\" above: \"This has no newline.\"\n\nkept: >+\n    This has four newlines.\n\n\n\nsame as \"kept\" above: \"This has four newlines.\\n\\n\\n\\n\"")).toEqual({
      'clipped': "This has one newline.\n",
      'same as "clipped" above': "This has one newline.\n",
      'stripped': 'This has no newline.',
      'same as "stripped" above': 'This has no newline.',
      'kept': "This has four newlines.\n\n\n\n",
      'same as "kept" above': "This has four newlines.\n\n\n\n"
    });
  });
  return it('can be the whole document as intented block', function() {
    return expect(YAML.parse("---\n  foo: \"bar\"\n  baz:\n    - \"qux\"\n    - \"quxx\"\n  corge: null")).toEqual({
      'foo': "bar",
      'baz': ['qux', 'quxx'],
      'corge': null
    });
  });
});

describe('Parsed YAML Comments', function() {
  it('can begin the document', function() {
    return expect(YAML.parse("# This is a comment\nhello: world")).toEqual({
      hello: 'world'
    });
  });
  it('can be less indented in mapping', function() {
    return expect(YAML.parse("parts:\n    a: 'b'\n    # normally indented comment\n    c: 'd'\n# less indented comment\n    e: 'f'")).toEqual({
      parts: {
        a: 'b',
        c: 'd',
        e: 'f'
      }
    });
  });
  it('can be less indented in sequence', function() {
    return expect(YAML.parse("list-header:\n  - item1\n#  - item2\n  - item3\n  # - item4")).toEqual({
      'list-header': ['item1', 'item3']
    });
  });
  it('can finish a line', function() {
    return expect(YAML.parse("hello: world # This is a comment")).toEqual({
      hello: 'world'
    });
  });
  return it('can end the document', function() {
    return expect(YAML.parse("hello: world\n# This is a comment")).toEqual({
      hello: 'world'
    });
  });
});

describe('Parsed YAML Aliases and Anchors', function() {
  it('can be simple alias', function() {
    return expect(YAML.parse("- &showell Steve\n- Clark\n- Brian\n- Oren\n- *showell")).toEqual(['Steve', 'Clark', 'Brian', 'Oren', 'Steve']);
  });
  return it('can be alias of a mapping', function() {
    return expect(YAML.parse("- &hello\n    Meat: pork\n    Starch: potato\n- banana\n- *hello")).toEqual([
      {
        Meat: 'pork',
        Starch: 'potato'
      }, 'banana', {
        Meat: 'pork',
        Starch: 'potato'
      }
    ]);
  });
});

describe('Parsed YAML Documents', function() {
  it('can have YAML header', function() {
    return expect(YAML.parse("--- %YAML:1.0\nfoo: 1\nbar: 2")).toEqual({
      foo: 1,
      bar: 2
    });
  });
  it('can have leading document separator', function() {
    return expect(YAML.parse("---\n- foo: 1\n  bar: 2")).toEqual([
      {
        foo: 1,
        bar: 2
      }
    ]);
  });
  return it('can have multiple document separators in block', function() {
    return expect(YAML.parse("foo: |\n    ---\n    foo: bar\n    ---\n    yo: baz\nbar: |\n    fooness")).toEqual({
      foo: "---\nfoo: bar\n---\nyo: baz\n",
      bar: "fooness\n"
    });
  });
});

describe('Dumped YAML Collections', function() {
  it('can be simple sequence', function() {
    return expect(YAML.parse("- apple\n- banana\n- carrot")).toEqual(YAML.parse(YAML.dump(['apple', 'banana', 'carrot'])));
  });
  it('can be nested sequences', function() {
    return expect(YAML.parse("-\n - foo\n - bar\n - baz")).toEqual(YAML.parse(YAML.dump([['foo', 'bar', 'baz']])));
  });
  it('can be mixed sequences', function() {
    return expect(YAML.parse("- apple\n-\n - foo\n - bar\n - x123\n- banana\n- carrot")).toEqual(YAML.parse(YAML.dump(['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot'])));
  });
  it('can be deeply nested sequences', function() {
    return expect(YAML.parse("-\n -\n  - uno\n  - dos")).toEqual(YAML.parse(YAML.dump([[['uno', 'dos']]])));
  });
  it('can be simple mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar: stuff")).toEqual(YAML.parse(YAML.dump({
      foo: 'whatever',
      bar: 'stuff'
    })));
  });
  it('can be sequence in a mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n - uno\n - dos")).toEqual(YAML.parse(YAML.dump({
      foo: 'whatever',
      bar: ['uno', 'dos']
    })));
  });
  it('can be nested mappings', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n fruit: apple\n name: steve\n sport: baseball")).toEqual(YAML.parse(YAML.dump({
      foo: 'whatever',
      bar: {
        fruit: 'apple',
        name: 'steve',
        sport: 'baseball'
      }
    })));
  });
  it('can be mixed mapping', function() {
    return expect(YAML.parse("foo: whatever\nbar:\n -\n   fruit: apple\n   name: steve\n   sport: baseball\n - more\n -\n   python: rocks\n   perl: papers\n   ruby: scissorses")).toEqual(YAML.parse(YAML.dump({
      foo: 'whatever',
      bar: [
        {
          fruit: 'apple',
          name: 'steve',
          sport: 'baseball'
        }, 'more', {
          python: 'rocks',
          perl: 'papers',
          ruby: 'scissorses'
        }
      ]
    })));
  });
  it('can have mapping-in-sequence shortcut', function() {
    return expect(YAML.parse("- work on YAML.py:\n   - work on Store")).toEqual(YAML.parse(YAML.dump([
      {
        'work on YAML.py': ['work on Store']
      }
    ])));
  });
  it('can have unindented sequence-in-mapping shortcut', function() {
    return expect(YAML.parse("allow:\n- 'localhost'\n- '%.sourceforge.net'\n- '%.freepan.org'")).toEqual(YAML.parse(YAML.dump({
      allow: ['localhost', '%.sourceforge.net', '%.freepan.org']
    })));
  });
  return it('can merge key', function() {
    return expect(YAML.parse("mapping:\n  name: Joe\n  job: Accountant\n  <<:\n    age: 38")).toEqual(YAML.parse(YAML.dump({
      mapping: {
        name: 'Joe',
        job: 'Accountant',
        age: 38
      }
    })));
  });
});

describe('Dumped YAML Inline Collections', function() {
  it('can be simple inline array', function() {
    return expect(YAML.parse("---\nseq: [ a, b, c ]")).toEqual(YAML.parse(YAML.dump({
      seq: ['a', 'b', 'c']
    })));
  });
  it('can be simple inline hash', function() {
    return expect(YAML.parse("---\nhash: { name: Steve, foo: bar }")).toEqual(YAML.parse(YAML.dump({
      hash: {
        name: 'Steve',
        foo: 'bar'
      }
    })));
  });
  it('can be multi-line inline collections', function() {
    return expect(YAML.parse("languages: [ Ruby,\n             Perl,\n             Python ]\nwebsites: { YAML: yaml.org,\n            Ruby: ruby-lang.org,\n            Python: python.org,\n            Perl: use.perl.org }")).toEqual(YAML.parse(YAML.dump({
      languages: ['Ruby', 'Perl', 'Python'],
      websites: {
        YAML: 'yaml.org',
        Ruby: 'ruby-lang.org',
        Python: 'python.org',
        Perl: 'use.perl.org'
      }
    })));
  });
  it('can be dumped empty sequences in mappings', function() {
    return expect(YAML.parse(YAML.dump({
      key: []
    }))).toEqual({
      key: []
    });
  });
  return it('can be dumpted empty inline collections', function() {
    return expect(YAML.parse(YAML.dump({
      key: {}
    }))).toEqual({
      key: {}
    });
  });
});

describe('Dumped YAML Basic Types', function() {
  it('can be strings', function() {
    return expect(YAML.parse("---\nString")).toEqual(YAML.parse(YAML.dump('String')));
  });
  it('can be double-quoted strings with backslashes', function() {
    return expect(YAML.parse("str:\n    \"string with \\\\ inside\"")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \\ inside'
    })));
  });
  it('can be single-quoted strings with backslashes', function() {
    return expect(YAML.parse("str:\n    'string with \\\\ inside'")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \\\\ inside'
    })));
  });
  it('can be double-quoted strings with line breaks', function() {
    return expect(YAML.parse("str:\n    \"string with \\n inside\"")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \n inside'
    })));
  });
  it('can be double-quoted strings with line breaks and backslashes', function() {
    return expect(YAML.parse("str:\n    \"string with \\n inside and \\\\ also\"")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \n inside and \\ also'
    })));
  });
  it('can be single-quoted strings with line breaks and backslashes', function() {
    return expect(YAML.parse("str:\n    'string with \\n inside and \\\\ also'")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \\n inside and \\\\ also'
    })));
  });
  it('can be single-quoted strings with escaped line breaks', function() {
    return expect(YAML.parse("str:\n    'string with \\n inside'")).toEqual(YAML.parse(YAML.dump({
      str: 'string with \\n inside'
    })));
  });
  it('can have string characters in sequences', function() {
    return expect(YAML.parse("- What's Yaml?\n- It's for writing data structures in plain text.\n- And?\n- And what? That's not good enough for you?\n- No, I mean, \"And what about Yaml?\"\n- Oh, oh yeah. Uh.. Yaml for JavaScript.")).toEqual(YAML.parse(YAML.dump(["What's Yaml?", "It's for writing data structures in plain text.", "And?", "And what? That's not good enough for you?", "No, I mean, \"And what about Yaml?\"", "Oh, oh yeah. Uh.. Yaml for JavaScript."])));
  });
  it('can have indicators in strings', function() {
    return expect(YAML.parse("the colon followed by space is an indicator: but is a string:right here\nsame for the pound sign: here we have it#in a string\nthe comma can, honestly, be used in most cases: [ but not in, inline collections ]")).toEqual(YAML.parse(YAML.dump({
      'the colon followed by space is an indicator': 'but is a string:right here',
      'same for the pound sign': 'here we have it#in a string',
      'the comma can, honestly, be used in most cases': ['but not in', 'inline collections']
    })));
  });
  it('can force strings', function() {
    return expect(YAML.parse("date string: !str 2001-08-01\nnumber string: !str 192\ndate string 2: !!str 2001-08-01\nnumber string 2: !!str 192")).toEqual(YAML.parse(YAML.dump({
      'date string': '2001-08-01',
      'number string': '192',
      'date string 2': '2001-08-01',
      'number string 2': '192'
    })));
  });
  it('can be single-quoted strings', function() {
    return expect(YAML.parse("all my favorite symbols: '#:!/%.)'\na few i hate: '&(*'\nwhy do i hate them?: 'it''s very hard to explain'")).toEqual(YAML.parse(YAML.dump({
      'all my favorite symbols': '#:!/%.)',
      'a few i hate': '&(*',
      'why do i hate them?': 'it\'s very hard to explain'
    })));
  });
  it('can be double-quoted strings', function() {
    return expect(YAML.parse("i know where i want my line breaks: \"one here\\nand another here\\n\"")).toEqual(YAML.parse(YAML.dump({
      'i know where i want my line breaks': "one here\nand another here\n"
    })));
  });
  it('can be null', function() {
    return expect(YAML.parse("name: Mr. Show\nhosted by: Bob and David\ndate of next season: ~")).toEqual(YAML.parse(YAML.dump({
      'name': 'Mr. Show',
      'hosted by': 'Bob and David',
      'date of next season': null
    })));
  });
  it('can be boolean', function() {
    return expect(YAML.parse("Is Gus a Liar?: true\nDo I rely on Gus for Sustenance?: false")).toEqual(YAML.parse(YAML.dump({
      'Is Gus a Liar?': true,
      'Do I rely on Gus for Sustenance?': false
    })));
  });
  it('can be integers', function() {
    return expect(YAML.parse("zero: 0\nsimple: 12\none-thousand: 1,000\nnegative one-thousand: -1,000")).toEqual(YAML.parse(YAML.dump({
      'zero': 0,
      'simple': 12,
      'one-thousand': 1000,
      'negative one-thousand': -1000
    })));
  });
  it('can be integers as map keys', function() {
    return expect(YAML.parse("1: one\n2: two\n3: three")).toEqual(YAML.parse(YAML.dump({
      1: 'one',
      2: 'two',
      3: 'three'
    })));
  });
  it('can be floats', function() {
    return expect(YAML.parse("a simple float: 2.00\nlarger float: 1,000.09\nscientific notation: 1.00009e+3")).toEqual(YAML.parse(YAML.dump({
      'a simple float': 2.0,
      'larger float': 1000.09,
      'scientific notation': 1000.09
    })));
  });
  it('can be time', function() {
    var iso8601Date, spaceSeparatedDate, withDatesToTime;
    iso8601Date = new Date(Date.UTC(2001, 12 - 1, 14, 21, 59, 43, 10));
    iso8601Date.setTime(iso8601Date.getTime() + 5 * 3600 * 1000);
    spaceSeparatedDate = new Date(Date.UTC(2001, 12 - 1, 14, 21, 59, 43, 10));
    spaceSeparatedDate.setTime(spaceSeparatedDate.getTime() - 5 * 3600 * 1000);
    withDatesToTime = function(input) {
      var key, res, val;
      res = {};
      for (key in input) {
        val = input[key];
        res[key] = val.getTime();
      }
      return res;
    };
    return expect(withDatesToTime(YAML.parse("iso8601: 2001-12-14t21:59:43.010-05:00\nspace separated: 2001-12-14 21:59:43.010 +05:00"))).toEqual(YAML.parse(YAML.dump(withDatesToTime({
      'iso8601': iso8601Date,
      'space separated': spaceSeparatedDate
    }))));
  });
  return it('can be date', function() {
    var aDate, withDatesToTime;
    aDate = new Date(Date.UTC(1976, 7 - 1, 31, 0, 0, 0, 0));
    withDatesToTime = function(input) {
      var key, res, val;
      return input;
      res = {};
      for (key in input) {
        val = input[key];
        res[key] = val.getTime();
      }
      return res;
    };
    return expect(withDatesToTime(YAML.parse("date: 1976-07-31"))).toEqual(YAML.parse(YAML.dump(withDatesToTime({
      'date': aDate
    }))));
  });
});

describe('Dumped YAML Blocks', function() {
  it('can be single ending newline', function() {
    return expect(YAML.parse("---\nthis: |\n    Foo\n    Bar")).toEqual(YAML.parse(YAML.dump({
      'this': "Foo\nBar\n"
    })));
  });
  it('can be single ending newline with \'+\' indicator', function() {
    return expect(YAML.parse("normal: |\n  extra new lines not kept\n\npreserving: |+\n  extra new lines are kept\n\n\ndummy: value")).toEqual(YAML.parse(YAML.dump({
      'normal': "extra new lines not kept\n",
      'preserving': "extra new lines are kept\n\n\n",
      'dummy': 'value'
    })));
  });
  it('can be multi-line block handling trailing newlines in function of \'+\', \'-\' indicators', function() {
    return expect(YAML.parse("clipped: |\n    This has one newline.\n\n\n\nsame as \"clipped\" above: \"This has one newline.\\n\"\n\nstripped: |-\n    This has no newline.\n\n\n\nsame as \"stripped\" above: \"This has no newline.\"\n\nkept: |+\n    This has four newlines.\n\n\n\nsame as \"kept\" above: \"This has four newlines.\\n\\n\\n\\n\"")).toEqual(YAML.parse(YAML.dump({
      'clipped': "This has one newline.\n",
      'same as "clipped" above': "This has one newline.\n",
      'stripped': 'This has no newline.',
      'same as "stripped" above': 'This has no newline.',
      'kept': "This has four newlines.\n\n\n\n",
      'same as "kept" above': "This has four newlines.\n\n\n\n"
    })));
  });
  it('can be folded block in a sequence', function() {
    return expect(YAML.parse("---\n- apple\n- banana\n- >\n    can't you see\n    the beauty of yaml?\n    hmm\n- dog")).toEqual(YAML.parse(YAML.dump(['apple', 'banana', "can't you see the beauty of yaml? hmm\n", 'dog'])));
  });
  it('can be folded block as a mapping value', function() {
    return expect(YAML.parse("---\nquote: >\n    Mark McGwire's\n    year was crippled\n    by a knee injury.\nsource: espn")).toEqual(YAML.parse(YAML.dump({
      'quote': "Mark McGwire's year was crippled by a knee injury.\n",
      'source': 'espn'
    })));
  });
  return it('can be folded block handling trailing newlines in function of \'+\', \'-\' indicators', function() {
    return expect(YAML.parse("clipped: >\n    This has one newline.\n\n\n\nsame as \"clipped\" above: \"This has one newline.\\n\"\n\nstripped: >-\n    This has no newline.\n\n\n\nsame as \"stripped\" above: \"This has no newline.\"\n\nkept: >+\n    This has four newlines.\n\n\n\nsame as \"kept\" above: \"This has four newlines.\\n\\n\\n\\n\"")).toEqual(YAML.parse(YAML.dump({
      'clipped': "This has one newline.\n",
      'same as "clipped" above': "This has one newline.\n",
      'stripped': 'This has no newline.',
      'same as "stripped" above': 'This has no newline.',
      'kept': "This has four newlines.\n\n\n\n",
      'same as "kept" above': "This has four newlines.\n\n\n\n"
    })));
  });
});

describe('Dumped YAML Comments', function() {
  it('can begin the document', function() {
    return expect(YAML.parse("# This is a comment\nhello: world")).toEqual(YAML.parse(YAML.dump({
      hello: 'world'
    })));
  });
  it('can finish a line', function() {
    return expect(YAML.parse("hello: world # This is a comment")).toEqual(YAML.parse(YAML.dump({
      hello: 'world'
    })));
  });
  return it('can end the document', function() {
    return expect(YAML.parse("hello: world\n# This is a comment")).toEqual(YAML.parse(YAML.dump({
      hello: 'world'
    })));
  });
});

describe('Dumped YAML Aliases and Anchors', function() {
  it('can be simple alias', function() {
    return expect(YAML.parse("- &showell Steve\n- Clark\n- Brian\n- Oren\n- *showell")).toEqual(YAML.parse(YAML.dump(['Steve', 'Clark', 'Brian', 'Oren', 'Steve'])));
  });
  return it('can be alias of a mapping', function() {
    return expect(YAML.parse("- &hello\n    Meat: pork\n    Starch: potato\n- banana\n- *hello")).toEqual(YAML.parse(YAML.dump([
      {
        Meat: 'pork',
        Starch: 'potato'
      }, 'banana', {
        Meat: 'pork',
        Starch: 'potato'
      }
    ])));
  });
});

describe('Dumped YAML Documents', function() {
  it('can have YAML header', function() {
    return expect(YAML.parse("--- %YAML:1.0\nfoo: 1\nbar: 2")).toEqual(YAML.parse(YAML.dump({
      foo: 1,
      bar: 2
    })));
  });
  it('can have leading document separator', function() {
    return expect(YAML.parse("---\n- foo: 1\n  bar: 2")).toEqual(YAML.parse(YAML.dump([
      {
        foo: 1,
        bar: 2
      }
    ])));
  });
  return it('can have multiple document separators in block', function() {
    return expect(YAML.parse("foo: |\n    ---\n    foo: bar\n    ---\n    yo: baz\nbar: |\n    fooness")).toEqual(YAML.parse(YAML.dump({
      foo: "---\nfoo: bar\n---\nyo: baz\n",
      bar: "fooness\n"
    })));
  });
});

url = typeof document !== "undefined" && document !== null ? (ref = document.location) != null ? ref.href : void 0 : void 0;

if (!(url != null) || url.indexOf('file://') === -1) {
  examplePath = 'spec/example.yml';
  if (typeof __dirname !== "undefined" && __dirname !== null) {
    examplePath = __dirname + '/example.yml';
  }
  describe('YAML loading', function() {
    it('can be done synchronously', function() {
      return expect(YAML.load(examplePath)).toEqual({
        "this": 'is',
        a: ['YAML', 'example']
      });
    });
    return it('can be done asynchronously', function(done) {
      return YAML.load(examplePath, function(result) {
        expect(result).toEqual({
          "this": 'is',
          a: ['YAML', 'example']
        });
        return done();
      });
    });
  });
}


code:
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)

### Bug Fixes

* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3))

### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20)

### Bug Fixes

* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143))
* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a))
* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b))

### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10)

### Bug Fixes

* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026))

### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22)

### Bug Fixes

* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146))

### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13)

### Bug Fixes

* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335))

### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09)

### Bug Fixes

* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306))

### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16)

### Bug Fixes

* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88))

### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14)

### Bug Fixes

* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d))

### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01)

### Bug Fixes

* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56))

## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21)

### Features

* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750))

### Bug Fixes

* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad))

## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20)

### Features

* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c))

### Bug Fixes

* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a))

## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09)

### ⚠ BREAKING CHANGES

* do not ship type definitions (#318)

### Bug Fixes

* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315)

### Code Refactoring

* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330))

### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27)

### Bug Fixes

* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5))

### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27)

### Bug Fixes

* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174))

### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27)

### Bug Fixes

* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523))

### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09)

### Bug Fixes

* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0))

## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09)

### ⚠ BREAKING CHANGES

* adds support for ESM and Deno (#295)
* **ts:** projects using `@types/yargs-parser` may see variations in type definitions.
* drops Node 6. begin following Node.js LTS schedule (#278)

### Features

* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1))
* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26))
* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516))

### Bug Fixes

* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418))
* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84))
* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7))
* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7))

### Build System

* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a))

### Code Refactoring

* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789))

### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16)

### Bug Fixes

* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e))

### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26)

### Bug Fixes

* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13))

### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16)

### Bug Fixes

* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))

## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07)

### Features

* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f))

## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)

### ⚠ BREAKING CHANGES

* the narg count is now enforced when parsing arrays.

### Features

* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))

## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)

### Features

* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb))

### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29)

### Bug Fixes

* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba))

## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10)

### ⚠ BREAKING CHANGES

* this reverts parsing behavior of booleans to that of yargs@14
* objects used during parsing are now created with a null
prototype. There may be some scenarios where this change in behavior
leaks externally.

### Features

* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5))
* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732))

### Bug Fixes

* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346))
* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c))
* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de))
* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5))

## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01)

### ⚠ BREAKING CHANGES

* populate error if incompatible narg/count or array/count options are used (#191)

### Features

* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0))
* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9))

### Reverts

* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf))

license: mit


code:
# yargs-parser

![ci](https://github.com/yargs/yargs-parser/workflows/ci/badge.svg)
[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/yargs-parser)

The mighty option parser used by [yargs](https://github.com/yargs/yargs).

visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.

## Example

```sh
npm i yargs-parser --save
```

```js
const argv = require('yargs-parser')(process.argv.slice(2))
console.log(argv)
```

```console
$ node example.js --foo=33 --bar hello
{ _: [], foo: 33, bar: 'hello' }
```

_or parse a string!_

```js
const argv = require('yargs-parser')('--foo=99 --bar=33')
console.log(argv)
```

```console
{ _: [], foo: 99, bar: 33 }
```

Convert an array of mixed types before passing to `yargs-parser`:

```js
const parse = require('yargs-parser')
parse(['-f', 11, '--zoom', 55].join(' '))   // <-- array to string
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
```

## Deno Example

As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):

```typescript
import parser from "https://deno.land/x/yargs_parser/deno.ts";

const argv = parser('--foo=99 --bar=9987930', {
  string: ['bar']
})
console.log(argv)
```

## ESM Example

As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):

**Node.js:**

```js
import parser from 'yargs-parser'

const argv = parser('--foo=99 --bar=9987930', {
  string: ['bar']
})
console.log(argv)
```

**Browsers:**

```html
<!doctype html>
<body>
  <script type="module">
    import parser from "https://unpkg.com/yargs-parser@19.0.0/browser.js";

    const argv = parser('--foo=99 --bar=9987930', {
      string: ['bar']
    })
    console.log(argv)
  </script>
</body>
```

## API

### parser(args, opts={})

Parses command line arguments returning a simple mapping of keys and values.

**expects:**

* `args`: a string or array of strings representing the options to parse.
* `opts`: provide a set of hints indicating how `args` should be parsed:
  * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
  * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.

    Indicate that keys should be parsed as an array and coerced to booleans / numbers:

    `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.
  * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
  * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
    (or throws an error). For arrays the function is called only once for the entire array:

    `{coerce: {foo: function (arg) {return modifiedArg}}}`.
  * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
  * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:

    `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`.
  * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
  * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
  * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
  * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
  * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.
  * `opts.normalize`: `path.normalize()` will be applied to values set to this key.
  * `opts.number`: keys should be treated as numbers.
  * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).

**returns:**

* `obj`: an object representing the parsed value of `args`
  * `key/value`: key value pairs for each argument and their aliases.
  * `_`: an array representing the positional arguments.
  * [optional] `--`:  an array with arguments after the end-of-options flag `--`.

### require('yargs-parser').detailed(args, opts={})

Parses a command line string, returning detailed information required by the
yargs engine.

**expects:**

* `args`: a string or array of strings representing options to parse.
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.

**returns:**

* `argv`: an object representing the parsed value of `args`
  * `key/value`: key value pairs for each argument and their aliases.
  * `_`: an array representing the positional arguments.
  * [optional] `--`:  an array with arguments after the end-of-options flag `--`.
* `error`: populated with an error object if an exception occurred during parsing.
* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
* `newAliases`: any new aliases added via camel-case expansion:
  * `boolean`: `{ fooBar: true }`
* `defaulted`: any new argument created by `opts.default`, no aliases included.
  * `boolean`: `{ foo: true }`
* `configuration`: given by default settings and `opts.configuration`.

### Configuration

The yargs-parser applies several automated transformations on the keys provided
in `args`. These features can be turned on and off using the `configuration` field
of `opts`.

```js
var parsed = parser(['--no-dice'], {
  configuration: {
    'boolean-negation': false
  }
})
```

### short option groups

* default: `true`.
* key: `short-option-groups`.

Should a group of short-options be treated as boolean flags?

```console
$ node example.js -abc
{ _: [], a: true, b: true, c: true }
```

_if disabled:_

```console
$ node example.js -abc
{ _: [], abc: true }
```

### camel-case expansion

* default: `true`.
* key: `camel-case-expansion`.

Should hyphenated arguments be expanded into camel-case aliases?

```console
$ node example.js --foo-bar
{ _: [], 'foo-bar': true, fooBar: true }
```

_if disabled:_

```console
$ node example.js --foo-bar
{ _: [], 'foo-bar': true }
```

### dot-notation

* default: `true`
* key: `dot-notation`

Should keys that contain `.` be treated as objects?

```console
$ node example.js --foo.bar
{ _: [], foo: { bar: true } }
```

_if disabled:_

```console
$ node example.js --foo.bar
{ _: [], "foo.bar": true }
```

### parse numbers

* default: `true`
* key: `parse-numbers`

Should keys that look like numbers be treated as such?

```console
$ node example.js --foo=99.3
{ _: [], foo: 99.3 }
```

_if disabled:_

```console
$ node example.js --foo=99.3
{ _: [], foo: "99.3" }
```

### parse positional numbers

* default: `true`
* key: `parse-positional-numbers`

Should positional keys that look like numbers be treated as such.

```console
$ node example.js 99.3
{ _: [99.3] }
```

_if disabled:_

```console
$ node example.js 99.3
{ _: ['99.3'] }
```

### boolean negation

* default: `true`
* key: `boolean-negation`

Should variables prefixed with `--no` be treated as negations?

```console
$ node example.js --no-foo
{ _: [], foo: false }
```

_if disabled:_

```console
$ node example.js --no-foo
{ _: [], "no-foo": true }
```

### combine arrays

* default: `false`
* key: `combine-arrays`

Should arrays be combined when provided by both command line arguments and
a configuration file.

### duplicate arguments array

* default: `true`
* key: `duplicate-arguments-array`

Should arguments be coerced into an array when duplicated:

```console
$ node example.js -x 1 -x 2
{ _: [], x: [1, 2] }
```

_if disabled:_

```console
$ node example.js -x 1 -x 2
{ _: [], x: 2 }
```

### flatten duplicate arrays

* default: `true`
* key: `flatten-duplicate-arrays`

Should array arguments be coerced into a single array when duplicated:

```console
$ node example.js -x 1 2 -x 3 4
{ _: [], x: [1, 2, 3, 4] }
```

_if disabled:_

```console
$ node example.js -x 1 2 -x 3 4
{ _: [], x: [[1, 2], [3, 4]] }
```

### greedy arrays

* default: `true`
* key: `greedy-arrays`

Should arrays consume more than one positional argument following their flag.

```console
$ node example --arr 1 2
{ _: [], arr: [1, 2] }
```

_if disabled:_

```console
$ node example --arr 1 2
{ _: [2], arr: [1] }
```

**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**

### nargs eats options

* default: `false`
* key: `nargs-eats-options`

Should nargs consume dash options as well as positional arguments.

### negation prefix

* default: `no-`
* key: `negation-prefix`

The prefix to use for negated boolean variables.

```console
$ node example.js --no-foo
{ _: [], foo: false }
```

_if set to `quux`:_

```console
$ node example.js --quuxfoo
{ _: [], foo: false }
```

### populate --

* default: `false`.
* key: `populate--`

Should unparsed flags be stored in `--` or `_`.

_If disabled:_

```console
$ node example.js a -b -- x y
{ _: [ 'a', 'x', 'y' ], b: true }
```

_If enabled:_

```console
$ node example.js a -b -- x y
{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
```

### set placeholder key

* default: `false`.
* key: `set-placeholder-key`.

Should a placeholder be added for keys not set via the corresponding CLI argument?

_If disabled:_

```console
$ node example.js -a 1 -c 2
{ _: [], a: 1, c: 2 }
```

_If enabled:_

```console
$ node example.js -a 1 -c 2
{ _: [], a: 1, b: undefined, c: 2 }
```

### halt at non-option

* default: `false`.
* key: `halt-at-non-option`.

Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line.

_If disabled:_

```console
$ node example.js -a run b -x y
{ _: [ 'b' ], a: 'run', x: 'y' }
```

_If enabled:_

```console
$ node example.js -a run b -x y
{ _: [ 'b', '-x', 'y' ], a: 'run' }
```

### strip aliased

* default: `false`
* key: `strip-aliased`

Should aliases be removed before returning results?

_If disabled:_

```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
```

_If enabled:_

```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1 }
```

### strip dashed

* default: `false`
* key: `strip-dashed`

Should dashed keys be removed before returning results?  This option has no effect if
`camel-case-expansion` is disabled.

_If disabled:_

```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1 }
```

_If enabled:_

```console
$ node example.js --test-field 1
{ _: [], testField: 1 }
```

### unknown options as args

* default: `false`
* key: `unknown-options-as-args`

Should unknown options be treated like regular arguments?  An unknown option is one that is not
configured in `opts`.

_If disabled_

```console
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
```

_If enabled_

```console
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
```

## Supported Node.js Versions

Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).

## Special Thanks

The yargs project evolves from optimist and minimist. It owes its
existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/

## License

ISC


code:
// Main entrypoint for ESM web browser environments. Avoids using Node.js
// specific libraries, such as "path".
//
// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
import { YargsParser } from './build/lib/yargs-parser.js'
const parser = new YargsParser({
  cwd: () => { return '' },
  format: (str, arg) => { return str.replace('%s', arg) },
  normalize: (str) => { return str },
  resolve: (str) => { return str },
  require: () => {
    throw Error('loading config from files not currently supported in browser')
  },
  env: () => {}
})

const yargsParser = function Parser (args, opts) {
  const result = parser.parse(args.slice(), opts)
  return result.argv
}
yargsParser.detailed = function (args, opts) {
  return parser.parse(args.slice(), opts)
}
yargsParser.camelCase = camelCase
yargsParser.decamelize = decamelize
yargsParser.looksLikeNumber = looksLikeNumber

export default yargsParser