every
Return true if every item in a list matches a predicate.
    list.every( callback [,thisArg] )
  
  Tests each item in list by calling callback on it.  If callback returns truthy for every
element in list, every returns true.
import { DefineList } from "can";
const names = new DefineList(["alice","adam","zack","zeffer"]);
const aNames = names.every((name) => {
  return name[0] === "a";
});
console.log(aNames); //-> false
Parameters
- callback {function(item, index, list)}:A function to call with each element of the DefineList. The three parameters that callback gets passed are: - item (*) - the element at index.
- index (Integer) - the index of the current element of the list.
- list (DefineList) - the DefineListthe elements are coming from.
 If callbackreturns a truthy result,everywill evaluate the callback on the next element. Otherwise,everywill returnfalse.
- thisArg {Object}:What thisshould be in thecallback.
Returns
 {Boolean}: 
true if calling the callback on every element in list returns a truthy value, false otherwise.
    list.every( props )
  
  Tests each item in list by comparing its properties to props.  If props match for every element in
list, every returns true.
import {DefineList} from "can";
const todos = new DefineList([
    {name: "dishes", complete: false},
    {name: "lawn", complete: true}
]);
const complete = todos.every({complete: true});
console.log(complete); //-> false
Parameters
- props {Object}:An object of key-value properties. Each key and value in propsmust be present on anitemfor theitemto match.
Returns
 {Boolean}: 
true if every element in list matches props, false otherwise.
 GitHub
GitHub Twitter
Twitter