Skip to content

Instantly share code, notes, and snippets.

@mattmccray
Created June 22, 2010 07:24
Show Gist options
  • Select an option

  • Save mattmccray/448127 to your computer and use it in GitHub Desktop.

Select an option

Save mattmccray/448127 to your computer and use it in GitHub Desktop.
person: {
name: 'matt'
age: 34
}
ok 'name' of person # OF tests object property names
ok 'matt' in person # IN tests object values (CURRENTLY FAILS)
brothers: ['matt', 'dan', 'sam']
ok 'matt' in brothers # IN tests object values
ok 0 of brothers # OF tests object property names
@mattmccray
Copy link
Author

Although, come to think of it...

'matt' in brothers

Makes sense when it's an array. But JS already uses in for testing keys against objects, so perhaps my suggestion is counterintuitive. Eh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment