Sha256: 99c5bf92cfbe80d070f7d73acba56952b4a74ef63ae089a42042e8c5c6cd1a8f

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

/*!
 * UI development toolkit for HTML5 (OpenUI5)
 * (c) Copyright 2009-2018 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define([], function() {
	"use strict";

	/**
	 * Iterates over elements of the given object or array.
	 *
	 * Numeric indexes are only used for instances of <code>Array</code>.
	 * For all other objects, including those with a numeric
	 * <code>length</code> property, the properties are iterated by name.
	 *
	 * When <code>fnCallback</code> returns <code>false</code>, then the iteration stops (break).
	 *
	 * @function
	 * @since 1.58
	 * @param {object|any[]} oObject object or array to enumerate the properties of
	 * @param {function} fnCallback function to call for each property name
	 * @alias module:sap/base/util/each
	 * @return {object|any[]} the given <code>oObject</code>
	 * @public
	 */
	var fnEach = function(oObject, fnCallback) {
		var isArray = Array.isArray(oObject),
			length, i;

		if ( isArray ) {
			for (i = 0, length = oObject.length; i < length; i++) {
				if ( fnCallback.call(oObject[i], i, oObject[i]) === false ) {
					break;
				}
			}
		} else {
			for ( i in oObject ) {
				if ( fnCallback.call(oObject[i], i, oObject[i] ) === false ) {
					break;
				}
			}
		}

		return oObject;
	};

	return fnEach;
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fiveapples-0.0.7 lib/openui5-runtime-1.60.23/resources/sap/base/util/each-dbg.js
fiveapples-0.0.6 lib/openui5-runtime-1.60.23/resources/sap/base/util/each-dbg.js
fiveapples-0.0.5 lib/openui5-runtime-1.60.23/resources/sap/base/util/each-dbg.js