1.0.14 • Published 7 years ago

key1 v1.0.14

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Key1

Extracts the key from an object with a single key/value pair. Returns null if anything else is passed to key1().

Installation

$ npm install key1

Example (test.js)

var key1 = require ('key1');

var k1 = key1 ({thisKey: 'thisVal'});
// returns 'thisKey'

var k2 = key1 ({x: 100, y: 120});
// returns null, since ob has > 1 key

k3 = key1 (undefined);
// returns null, since arg is undefined
// key1 always returns null, unless it's passed a non-null, non-Array object


k4 = key1 ([{a: 'a string'}]);
// returns null, since argument is an array
1.0.14

7 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago