Skip to content

Commit

Permalink
More comment cleanup. Enyo-DCO-1.1-Signed-Off-By: Jim Tang (jim.tang@…
Browse files Browse the repository at this point in the history
…lge.com)
  • Loading branch information
Jim Tang committed Mar 26, 2013
1 parent 9a37ace commit bc727a5
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions source/kernel/lang.js
Expand Up @@ -11,7 +11,7 @@


//*@public //*@public
/** /**
Determines whether a target is undefined. Returns a boolean value indicating whether a target is undefined.
*/ */
var exists = enyo.exists = function (target) { var exists = enyo.exists = function (target) {
return !(undefined === target); return !(undefined === target);
Expand Down Expand Up @@ -327,17 +327,17 @@


var toString = Object.prototype.toString; var toString = Object.prototype.toString;


//* Returns true if _it_ is a string. //* Returns true if the argument is a string.
enyo.isString = function(it) { enyo.isString = function(it) {
return toString.call(it) === "[object String]"; return toString.call(it) === "[object String]";
}; };


//* Returns true if _it_ is a function. //* Returns true if the argument is a function.
enyo.isFunction = function(it) { enyo.isFunction = function(it) {
return toString.call(it) === "[object Function]"; return toString.call(it) === "[object Function]";
}; };


//* Returns true if _it_ is an array. //* Returns true if the argument is an array.
enyo.isArray = Array.isArray || function(it) { enyo.isArray = Array.isArray || function(it) {
return toString.call(it) === "[object Array]"; return toString.call(it) === "[object Array]";
}; };
Expand Down Expand Up @@ -433,9 +433,9 @@
//*@public //*@public
/** /**
Takes a variable number of arrays and returns an array of Takes a variable number of arrays and returns an array of
only those values that are unique amongst all of the arrays. values that are unique across all of the arrays. Note that
Note this is not a particularly cheap method and should never this is not a particularly cheap method and should never be
be called recursively. called recursively.
TODO: test in IE8 TODO: test in IE8
TODO: figure out why the one-hit reversal wasn't working TODO: figure out why the one-hit reversal wasn't working
Expand Down Expand Up @@ -472,23 +472,23 @@


//*@public //*@public
/** /**
Returns only the unique values of an array or arrays. Returns the unique values found in one or more arrays.
*/ */
var unique = enyo.unique = union; var unique = enyo.unique = union;


//*@public //*@public
/** /**
Reduce an array or arrays removing any duplicate entries Reduces one or more arrays, removing any duplicate entries
amongst them. across them.
*/ */
var reduce = enyo.reduce = merge; var reduce = enyo.reduce = merge;


//*@public //*@public
/** /**
Convenience method that takes an array of properties and an object. Convenience method that takes an array of properties and an object
Will return a new object with just those properties named in the as parameters. Returns a new object with just those properties named
array if they exist on the base object. If the third parameter is in the array that are found to exist on the base object. If the third
true it will ignore falsy values. parameter is true, falsy values will be ignored.
*/ */
var only = enyo.only = function (properties, object, ignore) { var only = enyo.only = function (properties, object, ignore) {
var ret = {}; var ret = {};
Expand Down Expand Up @@ -516,13 +516,12 @@


//*@public //*@public
/** /**
Convenience method that takes 2 objects. The keys of the first objects Convenience method that takes two objects as parameters. For each key
will be mapped to their values in the returned object should they exist from the first object, if the key also exists in the second object, a
on the second object. It will return mapping of the key from the first object to the key from the second
a new object with the properties (should they exist) of the first array object is added to a result object, which is eventually returned. In
and the provided object to its equivalent indexed property-name in the other words, the returned object maps the named properties of the
second array on the new object. This merely maps the properties named in first object to the named properties of the second object.
the first array to the named properties in the second array.
*/ */
var remap = enyo.remap = function (map, obj) { var remap = enyo.remap = function (map, obj) {
var ret = {}; var ret = {};
Expand All @@ -537,10 +536,10 @@


//*@public //*@public
/** /**
Convenience method that takes an array of properties and an object. Convenience method that takes an array of properties and an object
Will return a new object with all of the keys in the object except as parameters. Returns a new object with all of the keys in the
those specified in the _properties_ array. The values are shallow object except those specified in the _properties_ array. The values
copies. are shallow copies.
*/ */
var except = enyo.except = function (properties, object) { var except = enyo.except = function (properties, object) {
// the new object to return with just the requested keys // the new object to return with just the requested keys
Expand Down Expand Up @@ -571,9 +570,9 @@


//*@public //*@public
/** /**
A helper method that can take an array of objects and return Helper method that accepts an array of objects and returns
a hash of those objects indexed by the specified property. If a filter a hash of those objects indexed by the specified property. If a filter
is provided it should accept four parameters: the key, the value is provided, it should accept four parameters: the key, the value
(object), the current mutable map reference, and an immutable (object), the current mutable map reference, and an immutable
copy of the original array of objects for comparison. copy of the original array of objects for comparison.
*/ */
Expand Down Expand Up @@ -613,9 +612,9 @@


//*@public //*@public
/** /**
Expects a string property and an array of objects that may Expects as parameters a string, _property_, and an array of objects
have the named property. Returns an array of all the values of that may have the named property. Returns an array of all the values
property in the objects in the array. of the named property in the objects in the array.
*/ */
var pluck = enyo.pluck = function (property, array) { var pluck = enyo.pluck = function (property, array) {
var ret = []; var ret = [];
Expand All @@ -624,26 +623,27 @@
// if we don't have a property to look for or an array of // if we don't have a property to look for or an array of
// objects to search through we have to return an empty array // objects to search through we have to return an empty array
if (!(exists(property) && exists(array))) return ret; if (!(exists(property) && exists(array))) return ret;
// if it isn't actually an array return an empty array // if it isn't actually an array, return an empty array
if (!(array instanceof Array)) return ret; if (!(array instanceof Array)) return ret;
// if property isn't a string then return an empty array // if property isn't a string, then return an empty array
if ("string" !== typeof property) return ret; if ("string" !== typeof property) return ret;
// now that sanity is established to some extent, lets get // now that sanity is established to some extent, let's get
// to work // to work
for (len = array.length; idx < len; ++idx) { for (len = array.length; idx < len; ++idx) {
// if the object in the array is actually undefined, skip // if the object in the array is actually undefined, skip
if (!exists(array[idx])) continue; if (!exists(array[idx])) continue;
// if it was found then check to see if the property // if it was found, then check to see if the property
// exists on it // exists on it
if (exists(array[idx][property])) ret.push(array[idx][property]); if (exists(array[idx][property])) ret.push(array[idx][property]);
} }
// return whatever we found if anything // return whatever we found, if anything
return ret; return ret;
}; };


/** /**
Creates a new array with all elements of _inArray_ that pass the test implemented by _inFunc_. Creates a new array with all elements of _inArray_ that pass the test
If _inContext_ is specified, _inFunc_ is called with _inContext_ as _this_. defined by _inFunc_. If _inContext_ is specified, _inFunc_ is called
with _inContext_ as _this_.
*/ */
enyo.filter = function(inArray, inFunc, inContext) { enyo.filter = function(inArray, inFunc, inContext) {
var c = inContext || this; var c = inContext || this;
Expand Down Expand Up @@ -696,12 +696,12 @@
/** /**
Clones an existing Array, or converts an array-like object into an Array. Clones an existing Array, or converts an array-like object into an Array.
If _inOffset_ is non-zero, the cloning is started from that index in the source Array. If _inOffset_ is non-zero, the cloning starts from that index in the source Array.
The clone may be appended to an existing Array by passing the existing Array as _inStartWith_. The clone may be appended to an existing Array by passing the existing Array as _inStartWith_.
Array-like objects have _length_ properties, and support square-bracket notation ([]). Array-like objects have _length_ properties, and support square-bracket notation ([]).
Often array-like objects do not support Array methods, such as _push_ or _concat_, and Often, array-like objects do not support Array methods, such as _push_ or _concat_, and
must be converted to Arrays before use. so must be converted to Arrays before use.
The special _arguments_ variable is an example of an array-like object. The special _arguments_ variable is an example of an array-like object.
*/ */
Expand All @@ -727,8 +727,8 @@
//* @public //* @public
/** /**
Copies custom properties from the _source_ object to the _target_ object. Copies custom properties from the _source_ object to the _target_ object.
If _target_ is falsey, an object is created. If _target_ is falsy, an object is created.
If _source_ is falsey, the target or empty object is returned. If _source_ is falsy, the target or empty object is returned.
*/ */
enyo.mixin = function(target, source) { enyo.mixin = function(target, source) {
target = target || {}; target = target || {};
Expand All @@ -753,7 +753,7 @@
Returns a function closure that will call (and return the value of) Returns a function closure that will call (and return the value of)
function _method_, with _scope_ as _this_. function _method_, with _scope_ as _this_.
_method_ can be a function or the string name of a function-valued _method_ may be a function or the string name of a function-valued
property on _scope_. property on _scope_.
Arguments to the closure are passed into the bound function. Arguments to the closure are passed into the bound function.
Expand Down

0 comments on commit bc727a5

Please sign in to comment.