1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00

rename values to items

This commit is contained in:
Eric O'Connell 2013-10-06 10:05:57 -07:00
parent 671d53da04
commit 2ce32baf54
3 changed files with 9 additions and 9 deletions

View File

@ -203,7 +203,7 @@ The callback receives `(err, actor)`.
The callback receives `(err, date)`.
## Config
### `Config#values`
### `Config#items`
`Object` - The keys are dotted precisely as the console output from `git config`. E.g., `{'user.name': 'John Doe'}`
## Status

View File

@ -9,9 +9,9 @@ C.Config = class Config
# Internal: Parse the config from stdout of a `git config` command
parse: (text)->
@values = {}
@items = {}
for line in text.split("\n")
if line.length == 0
continue
[key, value] = line.split('=')
@values[key] = value
@items[key] = value

View File

@ -22,15 +22,15 @@ describe "Config", ->
config.parse GIT_CONFIG
it "read the keys and values", ->
config.values['user.name'].should.equal 'John Doe'
config.values['user.email'].should.equal 'john.doe@git-scm.com'
config.values['core.editor'].should.equal 'pico'
config.items['user.name'].should.equal 'John Doe'
config.items['user.email'].should.equal 'john.doe@git-scm.com'
config.items['core.editor'].should.equal 'pico'
describe "with overlapping keys", ->
config = new Config.Config 'mock repo'
config.parse GIT_CONFIG_DUPLICATE_KEYS
it "read the keys and values", ->
config.values['user.name'].should.equal 'John Doe'
config.values['user.email'].should.equal 'john.doe@github.com'
config.values['core.editor'].should.equal 'emacs'
config.items['user.name'].should.equal 'John Doe'
config.items['user.email'].should.equal 'john.doe@github.com'
config.items['core.editor'].should.equal 'emacs'