@@ -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 >
5048Assigns all enumerable properties on ` source ` objects to ` target ` .
5149Similar to ` Object.assign ` , but takes inherited properties into account.
5250Does 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 >
6562Assigns all own enumerable properties on ` source ` objects to ` target ` .
6663Like ` Object.assign ` . Does not modify anything in the source objects.
6764Returns ` 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 >
7975Creates a shallow clone of the given object, taking all enumerable
8076properties into account.
8177Shallow 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 >
9186Creates a deep clone of the given object, taking all enumerable properties
9287into 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 >
10296Creates and returns an object inheriting from ` prototype ` and, optionally,
10397assigns enumerable properties from ` source ` objects to the new object.
10498Uses ` 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 >
117110Assigns all enumerable properties on ` source ` objects to ` target ` that the
118111` target ` already _ doesn't_ have. Uses ` key in obj ` to check for existence.
119112Does 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 >
137129Defines a getter on an object.
138130Similar to [ ` Object.prototype.__defineGetter__ ` ] [ __defineGetter__ ] , but
139131works in a standards compliant way.
@@ -155,8 +147,7 @@ Oolong.defineGetter(person, "age", function() {
155147person .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 >
160151Defines a setter on an object.
161152Similar to [ ` Object.prototype.__defineSetter__ ` ] [ __defineSetter__ ] , but
162153works in a standards compliant way.
@@ -179,8 +170,7 @@ person.age = 28
179170person .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 >
184174Calls the given function for all enumerable properties.
185175Returns the given object.
186176
@@ -193,8 +183,7 @@ var obj = {name: "John", age: 42}
193183Oolong .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 >
198187Calls the given function for all _ own_ enumerable properties.
199188Returns the given object.
200189
@@ -207,8 +196,7 @@ var obj = {name: "John", age: 42}
207196Oolong .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 >
212200Filters all enumerable properties and returns a new object with only those
213201properties 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 >
227214Alias 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 >
231217Alias 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 >
235220Checks whether the given object has the given property, inherited or not.
236221Given a set, but ` undefined ` property will still return ` true ` .
237222
@@ -242,8 +227,7 @@ Oolong.has(Object.create({name: "John"}), "name") // => true
242227Oolong .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 >
247231Checks whether the given object has the given property as an own property.
248232Given a set, but ` undefined ` property will still return ` true ` .
249233
@@ -254,8 +238,7 @@ Oolong.hasOwn(Object.create({name: "John"}), "name") // => false
254238Oolong .hasOwn ({}, " name" ) // => false
255239```
256240
257- <a name =" Oolong.isEmpty " />
258- ### Oolong.isEmpty(object)
241+ ### Oolong.isEmpty(object) <a name =" Oolong.isEmpty " ></a >
259242Checks whether the given object has any enumerable properties, inherited
260243or not.
261244
@@ -266,16 +249,13 @@ Oolong.isEmpty(Object.create({name: "John"})) // => false
266249Oolong .isEmpty ({}) // => true
267250```
268251
269- <a name =" Oolong.isIn " />
270- ### Oolong.isIn(object, key)
252+ ### Oolong.isIn(object, key) <a name =" Oolong.isIn " ></a >
271253Alias 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 >
275256Alias of [ ` hasOwn ` ] ( #Oolong.hasOwn ) .
276257
277- <a name =" Oolong.isObject " />
278- ### Oolong.isObject(object)
258+ ### Oolong.isObject(object) <a name =" Oolong.isObject " ></a >
279259Checks whether the given object is of type object and is not null.
280260
281261** Examples** :
@@ -286,8 +266,7 @@ Oolong.isObject(42) // => false
286266Oolong .isObject (null ) // => false
287267```
288268
289- <a name =" Oolong.isOwnEmpty " />
290- ### Oolong.isOwnEmpty(object)
269+ ### Oolong.isOwnEmpty(object) <a name =" Oolong.isOwnEmpty " ></a >
291270Checks whether the given object has any _ own_ enumerable properties.
292271
293272** Examples** :
@@ -297,8 +276,7 @@ Oolong.isOwnEmpty(Object.create({name: "John"})) // => true
297276Oolong .isOwnEmpty ({}) // => true
298277```
299278
300- <a name =" Oolong.isPlainObject " />
301- ### Oolong.isPlainObject(object)
279+ ### Oolong.isPlainObject(object) <a name =" Oolong.isPlainObject " ></a >
302280Checks whether the given object is one constructed by ` Object ` or inheriting
303281from ` null ` .
304282
@@ -320,8 +298,7 @@ Oolong.isPlainObject(new Date) // => false
320298Oolong .isPlainObject (" John" ) // => false
321299```
322300
323- <a name =" Oolong.keys " />
324- ### Oolong.keys(object)
301+ ### Oolong.keys(object) <a name =" Oolong.keys " ></a >
325302Returns all enumerable keys of an object as an array.
326303Similar to ` Object.keys ` , but takes inherited properties into account.
327304
@@ -330,8 +307,7 @@ Similar to `Object.keys`, but takes inherited properties into account.
330307Oolong .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 >
335311Looks up and returns a getter on an object.
336312Similar to [ ` Object.prototype.__lookupGetter__ ` ] [ __lookupGetter__ ] , but
337313works in a standards compliant way.
@@ -350,8 +326,7 @@ Oolong.defineGetter(person, "age", function() {
350326Oolong .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 >
355330Looks up and returns a setter on an object.
356331Similar to [ ` Object.prototype.__lookupSetter__ ` ] [ __lookupSetter__ ] , but
357332works in a standards compliant way.
@@ -370,8 +345,7 @@ Oolong.defineSetter(person, "age", function(age) {
370345Oolong .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 >
375349Maps all enumerable property values and returns a new object.
376350
377351The 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 >
389362Transforms all enumerable keys and returns a new object.
390363
391364The 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 >
403375Assigns all enumerable properties on ` source ` objects to ` target `
404376recursively.
405377Only plain objects a merged. Refer to
@@ -415,8 +387,7 @@ Oolong.merge(person, {attributes: {height: 190}})
415387person // => {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 >
420391Returns a new object with keys taken from the array ` keys ` and values
421392from 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 })
429400lengths // => {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 >
434404Returns all enumerable _ own_ keys of an object as an array.
435405Same as ` Object.keys ` , really.
436406
@@ -441,8 +411,7 @@ person.age = 42
441411Oolong .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 >
446415Filters the keys of an object to only those given as ` keys... ` .
447416Only keys that exist in ` object ` are included.
448417
@@ -452,8 +421,7 @@ var person = {name: "Alice", email: "
[email protected] ", age: 42}
452421Oolong .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 >
457425Filters the keys of an object to only those given as ` keys... ` with support
458426for nested keys in an array (` ["a", "b", "c"] ` ).
459427Only keys that exist in ` object ` are included.
@@ -474,8 +442,7 @@ var obj = Oolong.pickDeep(person, "name", ["address", "country"])
474442obj // => {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 >
479446Returns a new object with the same keys, but with values being the value's
480447property ` key ` .
481448In other words, it's the same as ` Oolong.map(obj, Oolong.property(key)) ` .
@@ -491,8 +458,7 @@ var people = {
491458Oolong .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 >
496462Returns a function that returns the given property of an object.
497463
498464** Examples** :
@@ -501,8 +467,7 @@ var getName = Oolong.property("name")
501467getName ({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 >
506471Rejects all enumerable properties and returns a new object without those
507472properties for which the given function returned truthy for.
508473Opposite 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 >
522486Set the prototype of the given object to the given prototype.
523487Pass ` null ` or another object for the prototype.
524488Returns ` object ` .
@@ -533,17 +497,15 @@ mike.name // => "Mike
533497mike .age // => 42
534498```
535499
536- <a name =" Oolong.values " />
537- ### Oolong.values(object)
500+ ### Oolong.values(object) <a name =" Oolong.values " ></a >
538501Returns all enumerable property values as an array.
539502
540503** Examples** :
541504``` javascript
542505Oolong .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 >
547509Wraps a given value in an object under the specified key.
548510Works also with [ ECMAScript 6 Symbol] ( https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol ) .
549511
0 commit comments