@bbn/bbn 1.0.348 → 1.0.349
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/object/getRow.d.ts +3 -2
- package/dist/fn/object/getRow.js +5 -3
- package/package.json +1 -1
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
* @param {Array} arr The subject array
|
|
36
36
|
* @param {(String|Object|Function)} prop A property's name or a filter object or function
|
|
37
37
|
* @param {*} val The value with which comparing the given property
|
|
38
|
-
* @param {String}
|
|
38
|
+
* @param {Number|false|String} operator The operator to use for comparison with the value as used in bbn.fn.compare
|
|
39
|
+
* @param {Number|false} from The index to start from, if false the search starts from the end
|
|
39
40
|
* @returns {Object|Boolean} The item if found, false otherwise
|
|
40
41
|
*/
|
|
41
|
-
export default function getRow(arr: any[], prop: object | string, val?: any, operator?: string): any | false;
|
|
42
|
+
export default function getRow(arr: any[], prop: object | string, val?: any, operator?: number | false | string, from?: false | number): any | false;
|
package/dist/fn/object/getRow.js
CHANGED
|
@@ -36,13 +36,15 @@ import search from './search.js';
|
|
|
36
36
|
* @param {Array} arr The subject array
|
|
37
37
|
* @param {(String|Object|Function)} prop A property's name or a filter object or function
|
|
38
38
|
* @param {*} val The value with which comparing the given property
|
|
39
|
-
* @param {String}
|
|
39
|
+
* @param {Number|false|String} operator The operator to use for comparison with the value as used in bbn.fn.compare
|
|
40
|
+
* @param {Number|false} from The index to start from, if false the search starts from the end
|
|
40
41
|
* @returns {Object|Boolean} The item if found, false otherwise
|
|
41
42
|
*/
|
|
42
|
-
export default function getRow(arr, prop, val, operator) {
|
|
43
|
+
export default function getRow(arr, prop, val, operator, from) {
|
|
43
44
|
if (val === void 0) { val = null; }
|
|
44
45
|
if (operator === void 0) { operator = '='; }
|
|
45
|
-
|
|
46
|
+
if (from === void 0) { from = 0; }
|
|
47
|
+
var idx = search(arr, prop, val, operator, from);
|
|
46
48
|
if (idx > -1) {
|
|
47
49
|
return arr[idx];
|
|
48
50
|
}
|