Object Functions Flashcards

1
Q

_.keys(object)

A

Retrieve all the names of the object’s own enumerable properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

_.allKeys(object)

A

Retrieve all the names of object’s own and inherited properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

_.values(object)

A

Return all of the values of the object’s own properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

_.mapObject(object, iteratee, [context])

A

Like map, but for objects. Transform the value of each property in turn. Iter: function(val, key)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

_.pairs(object)

A

Convert an object into a list of [key, value] pairs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

_.invert(object)

A

Returns a copy of the object where the keys have become the values and the values the keys. For this to work, all of your object’s values should be unique and string serializable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

_.create(prototype, props)

A

Creates a new object with the given prototype, optionally attaching props as own properties. Basically, Object.create, but without all of the property descriptor jazz.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

_.functions(object)

A

Returns a sorted list of the names of every method in an object — that is to say, the name of every function property of the object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

_.findKey(object, predicate, [context])

A

Similar to _.findIndex but for keys in objects. Returns the key where the predicate truth test passes or undefined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

_.extend(destination, *sources)

A

Copy all of the properties in the source objects over to the destination object, and return the destination object. It’s in-order, so the last source will override properties of the same name in previous arguments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

_.extendOwn(destination, *sources)

A

Like extend, but only copies own properties over to the destination object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

_.pick(object, *keys)

A

Return a copy of the object, filtered to only have values for the whitelisted keys (or array of valid keys). Alternatively accepts a predicate indicating which keys to pick.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

_.omit(object, *keys)

A

Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). Alternatively accepts a predicate indicating which keys to omit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

_.defaults(object, *defaults)

A

Fill in undefined properties in object with the first value present in the following list of defaults objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

_.clone(object)

A

Create a shallow-copied clone of the provided plain object. Any nested objects or arrays will be copied by reference, not duplicated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

_.tap(object, interceptor)

A

Invokes interceptor with the object, and then returns object. The primary purpose of this method is to “tap into” a method chain, in order to perform operations on intermediate results within the chain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

_.has(object, key)

A

Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe reference to the hasOwnProperty function, in case it’s been overridden accidentally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

_.property(key)

A

Returns a function that will itself return the key property of any passed-in object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

_.propertyOf(object)

A

Inverse of _.property. Takes an object and returns a function which will return the value of a provided property.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

_.matcher(attrs)

A

Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

_.isEqual(object, other)

A

Performs an optimized deep comparison between the two objects, to determine if they should be considered equal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

_.isMatch(object, properties)

A

Tells you if the keys and values in properties are contained in object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

_.isEmpty(object)

A

Returns true if an enumerable object contains no values (no enumerable own-properties). For strings and array-like objects _.isEmpty checks if the length property is 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

_.isElement(object)

A

Returns true if object is a DOM element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

_.isArray(object)

A

Returns true if object is an Array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

_.isObject(value)

A

Returns true if value is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings and numbers are not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

_.isArguments(object)

A

Returns true if object is an Arguments object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

_.isFunction(object)

A

Returns true if object is a Function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

_.isString(object)

A

Returns true if object is a String.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

_.isNumber(object)

A

Returns true if object is a Number (including NaN).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

_.isFinite(object)

A

Returns true if object is a finite Number.

32
Q

_.isBoolean(object)

A

Returns true if object is either true or false.

33
Q

_.isDate(object)

A

Returns true if object is a Date.

34
Q

_.isRegExp(object)

A

Returns true if object is a RegExp.

35
Q

_.isError(object)

A

Returns true if object inherrits from an Error.

36
Q

_.isNaN(object)

A

Returns true if object is NaN.

37
Q

_.isNull(object)

A

Returns true if the value of object is null.

38
Q

_.isUndefined(value)

A

Returns true if value is undefined.

39
Q

Retrieve all the names of the object’s own enumerable properties.

A

_.keys(object)

40
Q

Retrieve all the names of object’s own and inherited properties.

A

_.allKeys(object)

41
Q

Return all of the values of the object’s own properties.

A

_.values(object)

42
Q

Like map, but for objects. Transform the value of each property in turn. Iter: function(val, key)

A

_.mapObject(object, iteratee, [context])

43
Q

Convert an object into a list of [key, value] pairs.

A

_.pairs(object)

44
Q

Returns a copy of the object where the keys have become the values and the values the keys. For this to work, all of your object’s values should be unique and string serializable.

A

_.invert(object)

45
Q

Creates a new object with the given prototype, optionally attaching props as own properties. Basically, Object.create, but without all of the property descriptor jazz.

A

_.create(prototype, props)

46
Q

Returns a sorted list of the names of every method in an object — that is to say, the name of every function property of the object.

A

_.functions(object)

47
Q

Similar to _.findIndex but for keys in objects. Returns the key where the predicate truth test passes or undefined.

A

_.findKey(object, predicate, [context])

48
Q

Copy all of the properties in the source objects over to the destination object, and return the destination object. It’s in-order, so the last source will override properties of the same name in previous arguments.

A

_.extend(destination, *sources)

49
Q

Like extend, but only copies own properties over to the destination object.

A

_.extendOwn(destination, *sources)

50
Q

Return a copy of the object, filtered to only have values for the whitelisted keys (or array of valid keys). Alternatively accepts a predicate indicating which keys to pick.

A

_.pick(object, *keys)

51
Q

Return a copy of the object, filtered to omit the blacklisted keys (or array of keys). Alternatively accepts a predicate indicating which keys to omit.

A

_.omit(object, *keys)

52
Q

Fill in undefined properties in object with the first value present in the following list of defaults objects.

A

_.defaults(object, *defaults)

53
Q

Create a shallow-copied clone of the provided plain object. Any nested objects or arrays will be copied by reference, not duplicated.

A

_.clone(object)

54
Q

Invokes interceptor with the object, and then returns object. The primary purpose of this method is to “tap into” a method chain, in order to perform operations on intermediate results within the chain.

A

_.tap(object, interceptor)

55
Q

Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe reference to the hasOwnProperty function, in case it’s been overridden accidentally.

A

_.has(object, key)

56
Q

Returns a function that will itself return the key property of any passed-in object.

A

_.property(key)

57
Q

Inverse of _.property. Takes an object and returns a function which will return the value of a provided property.

A

_.propertyOf(object)

58
Q

Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs.

A

_.matcher(attrs)

59
Q

Performs an optimized deep comparison between the two objects, to determine if they should be considered equal.

A

_.isEqual(object, other)

60
Q

Tells you if the keys and values in properties are contained in object.

A

_.isMatch(object, properties)

61
Q

Returns true if an enumerable object contains no values (no enumerable own-properties). For strings and array-like objects _.isEmpty checks if the length property is 0.

A

_.isEmpty(object)

62
Q

Returns true if object is a DOM element.

A

_.isElement(object)

63
Q

Returns true if object is an Array.

A

_.isArray(object)

64
Q

Returns true if value is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings and numbers are not.

A

_.isObject(value)

65
Q

Returns true if object is an Arguments object.

A

_.isArguments(object)

66
Q

Returns true if object is a Function.

A

_.isFunction(object)

67
Q

Returns true if object is a String.

A

_.isString(object)

68
Q

Returns true if object is a Number (including NaN).

A

_.isNumber(object)

69
Q

Returns true if object is a finite Number.

A

_.isFinite(object)

70
Q

Returns true if object is either true or false.

A

_.isBoolean(object)

71
Q

Returns true if object is a Date.

A

_.isDate(object)

72
Q

Returns true if object is a RegExp.

A

_.isRegExp(object)

73
Q

Returns true if object inherrits from an Error.

A

_.isError(object)

74
Q

Returns true if object is NaN.

A

_.isNaN(object)

75
Q

Returns true if the value of object is null.

A

_.isNull(object)

76
Q

Returns true if value is undefined.

A

_.isUndefined(value)