Skip to content

Commit afa75eb

Browse files
committed
Fix API documentation anchors for GitHub.
1 parent 92391c8 commit afa75eb

File tree

1 file changed

+38
-76
lines changed

1 file changed

+38
-76
lines changed

doc/API.md

Lines changed: 38 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ Oolong.js API Documentation
4040
- [.wrap](#Oolong.wrap)(value, key)
4141

4242

43-
<a name="Oolong" />
44-
Oolong
43+
Oolong <a name="Oolong"></a>
4544
------
4645

4746

48-
<a name="Oolong.assign" />
49-
### Oolong.assign(target, source...)
47+
### Oolong.assign(target, source...) <a name="Oolong.assign"></a>
5048
Assigns all enumerable properties on `source` objects to `target`.
5149
Similar to `Object.assign`, but takes inherited properties into account.
5250
Does not modify anything in the source objects.
@@ -60,8 +58,7 @@ Oolong.assign({name: "John"}, {age: 32}, {shirt: "blue"})
6058
// => {name: "John", age: 32, shirt: "blue"}
6159
```
6260

63-
<a name="Oolong.assignOwn" />
64-
### Oolong.assignOwn(target, source...)
61+
### Oolong.assignOwn(target, source...) <a name="Oolong.assignOwn"></a>
6562
Assigns all own enumerable properties on `source` objects to `target`.
6663
Like `Object.assign`. Does not modify anything in the source objects.
6764
Returns `target`.
@@ -74,8 +71,7 @@ Oolong.assignOwn({name: "John"}, {age: 32}, Object.create({shirt: "blue"}))
7471
// => {name: "John", age: 32}
7572
```
7673

77-
<a name="Oolong.clone" />
78-
### Oolong.clone(object)
74+
### Oolong.clone(object) <a name="Oolong.clone"></a>
7975
Creates a shallow clone of the given object, taking all enumerable
8076
properties into account.
8177
Shallow means if you've got nested objects, those will be shared.
@@ -86,8 +82,7 @@ Oolong.clone({name: "John", age: 32})
8682
// => {name: "John", age: 32}
8783
```
8884

89-
<a name="Oolong.cloneDeep" />
90-
### Oolong.cloneDeep(object)
85+
### Oolong.cloneDeep(object) <a name="Oolong.cloneDeep"></a>
9186
Creates a deep clone of the given object, taking all enumerable properties
9287
into account.
9388

@@ -97,8 +92,7 @@ Oolong.cloneDeep({name: "John", attributes: {age: 42}})
9792
// => {name: "John", attributes: {age: 42}}
9893
```
9994

100-
<a name="Oolong.create" />
101-
### Oolong.create(prototype, [source...])
95+
### Oolong.create(prototype, [source...]) <a name="Oolong.create"></a>
10296
Creates and returns an object inheriting from `prototype` and, optionally,
10397
assigns enumerable properties from `source` objects to the new object.
10498
Uses `Object.create` and [`Oolong.assign`](#Oolong.assign)
@@ -112,8 +106,7 @@ Oolong.create(PERSON, {name: "John"}, {shirt: "blue"})
112106
// => {name: "John", age: 0, shirt: "blue"}
113107
```
114108

115-
<a name="Oolong.defaults" />
116-
### Oolong.defaults(target, source...)
109+
### Oolong.defaults(target, source...) <a name="Oolong.defaults"></a>
117110
Assigns all enumerable properties on `source` objects to `target` that the
118111
`target` already _doesn't_ have. Uses `key in obj` to check for existence.
119112
Does not modify anything in the source objects.
@@ -132,8 +125,7 @@ Oolong.defaults({name: "John", age: 42}, PERSON)
132125
// => {name: "John", age: 42, shirt: "blue"}
133126
```
134127

135-
<a name="Oolong.defineGetter" />
136-
### Oolong.defineGetter(object, property, fn)
128+
### Oolong.defineGetter(object, property, fn) <a name="Oolong.defineGetter"></a>
137129
Defines a getter on an object.
138130
Similar to [`Object.prototype.__defineGetter__`][__defineGetter__], but
139131
works in a standards compliant way.
@@ -155,8 +147,7 @@ Oolong.defineGetter(person, "age", function() {
155147
person.age // => 28 as of today in 2015.
156148
```
157149

158-
<a name="Oolong.defineSetter" />
159-
### Oolong.defineSetter(object, property, fn)
150+
### Oolong.defineSetter(object, property, fn) <a name="Oolong.defineSetter"></a>
160151
Defines a setter on an object.
161152
Similar to [`Object.prototype.__defineSetter__`][__defineSetter__], but
162153
works in a standards compliant way.
@@ -179,8 +170,7 @@ person.age = 28
179170
person.birthyear // => 1987 as of today in 2015.
180171
```
181172

182-
<a name="Oolong.each" />
183-
### Oolong.each(object, callback, [thisArg])
173+
### Oolong.each(object, callback, [thisArg]) <a name="Oolong.each"></a>
184174
Calls the given function for all enumerable properties.
185175
Returns the given object.
186176

@@ -193,8 +183,7 @@ var obj = {name: "John", age: 42}
193183
Oolong.each(obj, function(val, key) { console.log(key + "=" + val) })
194184
```
195185

196-
<a name="Oolong.eachOwn" />
197-
### Oolong.eachOwn(object, callback, [thisArg])
186+
### Oolong.eachOwn(object, callback, [thisArg]) <a name="Oolong.eachOwn"></a>
198187
Calls the given function for all _own_ enumerable properties.
199188
Returns the given object.
200189

@@ -207,8 +196,7 @@ var obj = {name: "John", age: 42}
207196
Oolong.eachOwn(obj, function(val, key) { console.log(key + "=" + val) })
208197
```
209198

210-
<a name="Oolong.filter" />
211-
### Oolong.filter(object, callback, [thisArg])
199+
### Oolong.filter(object, callback, [thisArg]) <a name="Oolong.filter"></a>
212200
Filters all enumerable properties and returns a new object with only those
213201
properties for which the given function returned truthy for.
214202

@@ -222,16 +210,13 @@ Oolong.filter(obj, function(value, key) { return value % 2 == 0 })
222210
// => {b: 2, d: 4}
223211
```
224212

225-
<a name="Oolong.forEach" />
226-
### Oolong.forEach(object, callback, [thisArg])
213+
### Oolong.forEach(object, callback, [thisArg]) <a name="Oolong.forEach"></a>
227214
Alias of [`each`](#Oolong.each).
228215

229-
<a name="Oolong.forEachOwn" />
230-
### Oolong.forEachOwn(object, callback, [thisArg])
216+
### Oolong.forEachOwn(object, callback, [thisArg]) <a name="Oolong.forEachOwn"></a>
231217
Alias of [`eachOwn`](#Oolong.eachOwn).
232218

233-
<a name="Oolong.has" />
234-
### Oolong.has(object, key)
219+
### Oolong.has(object, key) <a name="Oolong.has"></a>
235220
Checks whether the given object has the given property, inherited or not.
236221
Given a set, but `undefined` property will still return `true`.
237222

@@ -242,8 +227,7 @@ Oolong.has(Object.create({name: "John"}), "name") // => true
242227
Oolong.has({}, "name") // => false
243228
```
244229

245-
<a name="Oolong.hasOwn" />
246-
### Oolong.hasOwn(object, key)
230+
### Oolong.hasOwn(object, key) <a name="Oolong.hasOwn"></a>
247231
Checks whether the given object has the given property as an own property.
248232
Given a set, but `undefined` property will still return `true`.
249233

@@ -254,8 +238,7 @@ Oolong.hasOwn(Object.create({name: "John"}), "name") // => false
254238
Oolong.hasOwn({}, "name") // => false
255239
```
256240

257-
<a name="Oolong.isEmpty" />
258-
### Oolong.isEmpty(object)
241+
### Oolong.isEmpty(object) <a name="Oolong.isEmpty"></a>
259242
Checks whether the given object has any enumerable properties, inherited
260243
or not.
261244

@@ -266,16 +249,13 @@ Oolong.isEmpty(Object.create({name: "John"})) // => false
266249
Oolong.isEmpty({}) // => true
267250
```
268251

269-
<a name="Oolong.isIn" />
270-
### Oolong.isIn(object, key)
252+
### Oolong.isIn(object, key) <a name="Oolong.isIn"></a>
271253
Alias of [`has`](#Oolong.has).
272254

273-
<a name="Oolong.isInOwn" />
274-
### Oolong.isInOwn(object, key)
255+
### Oolong.isInOwn(object, key) <a name="Oolong.isInOwn"></a>
275256
Alias of [`hasOwn`](#Oolong.hasOwn).
276257

277-
<a name="Oolong.isObject" />
278-
### Oolong.isObject(object)
258+
### Oolong.isObject(object) <a name="Oolong.isObject"></a>
279259
Checks whether the given object is of type object and is not null.
280260

281261
**Examples**:
@@ -286,8 +266,7 @@ Oolong.isObject(42) // => false
286266
Oolong.isObject(null) // => false
287267
```
288268

289-
<a name="Oolong.isOwnEmpty" />
290-
### Oolong.isOwnEmpty(object)
269+
### Oolong.isOwnEmpty(object) <a name="Oolong.isOwnEmpty"></a>
291270
Checks whether the given object has any _own_ enumerable properties.
292271

293272
**Examples**:
@@ -297,8 +276,7 @@ Oolong.isOwnEmpty(Object.create({name: "John"})) // => true
297276
Oolong.isOwnEmpty({}) // => true
298277
```
299278

300-
<a name="Oolong.isPlainObject" />
301-
### Oolong.isPlainObject(object)
279+
### Oolong.isPlainObject(object) <a name="Oolong.isPlainObject"></a>
302280
Checks whether the given object is one constructed by `Object` or inheriting
303281
from `null`.
304282

@@ -320,8 +298,7 @@ Oolong.isPlainObject(new Date) // => false
320298
Oolong.isPlainObject("John") // => false
321299
```
322300

323-
<a name="Oolong.keys" />
324-
### Oolong.keys(object)
301+
### Oolong.keys(object) <a name="Oolong.keys"></a>
325302
Returns all enumerable keys of an object as an array.
326303
Similar to `Object.keys`, but takes inherited properties into account.
327304

@@ -330,8 +307,7 @@ Similar to `Object.keys`, but takes inherited properties into account.
330307
Oolong.keys({name: "John", age: 32}) // => ["name", "age"]
331308
```
332309

333-
<a name="Oolong.lookupGetter" />
334-
### Oolong.lookupGetter(object, property)
310+
### Oolong.lookupGetter(object, property) <a name="Oolong.lookupGetter"></a>
335311
Looks up and returns a getter on an object.
336312
Similar to [`Object.prototype.__lookupGetter__`][__lookupGetter__], but
337313
works in a standards compliant way.
@@ -350,8 +326,7 @@ Oolong.defineGetter(person, "age", function() {
350326
Oolong.lookupGetter(person, "age") // Returns the function above.
351327
```
352328

353-
<a name="Oolong.lookupSetter" />
354-
### Oolong.lookupSetter(object, property)
329+
### Oolong.lookupSetter(object, property) <a name="Oolong.lookupSetter"></a>
355330
Looks up and returns a setter on an object.
356331
Similar to [`Object.prototype.__lookupSetter__`][__lookupSetter__], but
357332
works in a standards compliant way.
@@ -370,8 +345,7 @@ Oolong.defineSetter(person, "age", function(age) {
370345
Oolong.lookupSetter(person, "age") // Returns the function above.
371346
```
372347

373-
<a name="Oolong.map" />
374-
### Oolong.map(object, callback, [thisArg])
348+
### Oolong.map(object, callback, [thisArg]) <a name="Oolong.map"></a>
375349
Maps all enumerable property values and returns a new object.
376350

377351
The function will be called with arguments `value`, `key` and `object` and
@@ -384,8 +358,7 @@ Oolong.map(obj, function(value, key) { return value * 2 })
384358
// => {a: 2, b: 4, c: 6}
385359
```
386360

387-
<a name="Oolong.mapKeys" />
388-
### Oolong.mapKeys(object, callback, [thisArg])
361+
### Oolong.mapKeys(object, callback, [thisArg]) <a name="Oolong.mapKeys"></a>
389362
Transforms all enumerable keys and returns a new object.
390363

391364
The function will be called with arguments `key`, `value` and `object` and
@@ -398,8 +371,7 @@ Oolong.mapKeys(person, function(key) { return key.toUpperCase() })
398371
// => {NAME: "John", AGE: 32}
399372
```
400373

401-
<a name="Oolong.merge" />
402-
### Oolong.merge(target, source...)
374+
### Oolong.merge(target, source...) <a name="Oolong.merge"></a>
403375
Assigns all enumerable properties on `source` objects to `target`
404376
recursively.
405377
Only plain objects a merged. Refer to
@@ -415,8 +387,7 @@ Oolong.merge(person, {attributes: {height: 190}})
415387
person // => {name: "John", attributes: {age: 42, height: 190}}
416388
```
417389

418-
<a name="Oolong.object" />
419-
### Oolong.object(keys, callback, [thisArg])
390+
### Oolong.object(keys, callback, [thisArg]) <a name="Oolong.object"></a>
420391
Returns a new object with keys taken from the array `keys` and values
421392
from the result of calling the given function with `key`, `index` and
422393
`keys`.
@@ -429,8 +400,7 @@ var lengths = Oolong.object(names, function(name) { return name.length })
429400
lengths // => {Alice: 5, Bob: 3, Charlie: 7}
430401
```
431402

432-
<a name="Oolong.ownKeys" />
433-
### Oolong.ownKeys(object)
403+
### Oolong.ownKeys(object) <a name="Oolong.ownKeys"></a>
434404
Returns all enumerable _own_ keys of an object as an array.
435405
Same as `Object.keys`, really.
436406

@@ -441,8 +411,7 @@ person.age = 42
441411
Oolong.ownKeys(person) // => ["age"]
442412
```
443413

444-
<a name="Oolong.pick" />
445-
### Oolong.pick(object, keys...)
414+
### Oolong.pick(object, keys...) <a name="Oolong.pick"></a>
446415
Filters the keys of an object to only those given as `keys...`.
447416
Only keys that exist in `object` are included.
448417

@@ -452,8 +421,7 @@ var person = {name: "Alice", email: "[email protected]", age: 42}
452421
Oolong.pick(person, "name", "age") // => {name: "Alice", age: 42}
453422
```
454423

455-
<a name="Oolong.pickDeep" />
456-
### Oolong.pickDeep(object, keys...)
424+
### Oolong.pickDeep(object, keys...) <a name="Oolong.pickDeep"></a>
457425
Filters the keys of an object to only those given as `keys...` with support
458426
for nested keys in an array (`["a", "b", "c"]`).
459427
Only keys that exist in `object` are included.
@@ -474,8 +442,7 @@ var obj = Oolong.pickDeep(person, "name", ["address", "country"])
474442
obj // => {name: "Alice", address: {country: "UK"}}
475443
```
476444

477-
<a name="Oolong.pluck" />
478-
### Oolong.pluck(object, key)
445+
### Oolong.pluck(object, key) <a name="Oolong.pluck"></a>
479446
Returns a new object with the same keys, but with values being the value's
480447
property `key`.
481448
In other words, it's the same as `Oolong.map(obj, Oolong.property(key))`.
@@ -491,8 +458,7 @@ var people = {
491458
Oolong.pluck(people, "name") // => {a: "Alice", b: "Bob", c: "Charlie"}
492459
```
493460

494-
<a name="Oolong.property" />
495-
### Oolong.property(key)
461+
### Oolong.property(key) <a name="Oolong.property"></a>
496462
Returns a function that returns the given property of an object.
497463

498464
**Examples**:
@@ -501,8 +467,7 @@ var getName = Oolong.property("name")
501467
getName({name: "John"}) // => "John
502468
```
503469

504-
<a name="Oolong.reject" />
505-
### Oolong.reject(object, callback, [thisArg])
470+
### Oolong.reject(object, callback, [thisArg]) <a name="Oolong.reject"></a>
506471
Rejects all enumerable properties and returns a new object without those
507472
properties for which the given function returned truthy for.
508473
Opposite of [`filter`](#Oolong.filter).
@@ -517,8 +482,7 @@ Oolong.reject(obj, function(value, key) { return value % 2 == 0 })
517482
// => {a: 1, c: 3}
518483
```
519484

520-
<a name="Oolong.setPrototypeOf" />
521-
### Oolong.setPrototypeOf(object, prototype)
485+
### Oolong.setPrototypeOf(object, prototype) <a name="Oolong.setPrototypeOf"></a>
522486
Set the prototype of the given object to the given prototype.
523487
Pass `null` or another object for the prototype.
524488
Returns `object`.
@@ -533,17 +497,15 @@ mike.name // => "Mike
533497
mike.age // => 42
534498
```
535499

536-
<a name="Oolong.values" />
537-
### Oolong.values(object)
500+
### Oolong.values(object) <a name="Oolong.values"></a>
538501
Returns all enumerable property values as an array.
539502

540503
**Examples**:
541504
```javascript
542505
Oolong.values({name: "John", age: 32}) // => ["John", 32]
543506
```
544507

545-
<a name="Oolong.wrap" />
546-
### Oolong.wrap(value, key)
508+
### Oolong.wrap(value, key) <a name="Oolong.wrap"></a>
547509
Wraps a given value in an object under the specified key.
548510
Works also with [ECMAScript 6 Symbol](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol).
549511

0 commit comments

Comments
 (0)