<commit_before># Type

## ax5.util.getType
Return argument object type
```js
ax5.util.getType(1); // "number"
ax5.util.getType("1"); // "string"
ax5.util.getType([0, 1, 2]); // "array"
ax5.util.getType({a: 1}); // "object"
ax5.util.getType(function () {}); // "function"
ax5.util.getType(document.querySelectorAll("div")); // "nodelist"
ax5.util.getType(document.createDocumentFragment()); // "fragment"
```
Javascript object type name is not clear. so util.getType method very useful.

---
f
## ax5.util.is(Type)
Return argument object type is [type] result.
```js
// return is window.
ax5.util.isWindow(window);

// return is element.
ax5.util.isElement(document.getElementById("#ax5-util-is-type"));

// return is Object.
ax5.util.isObject({});

// return is Array.
ax5.util.isArray([]);

// return is Functon.
ax5.util.isFunction(new Function);

// return is String.
ax5.util.isString('');

// return is Number.
ax5.util.isNumber(1);

// return is nodeList.
ax5.util.isNodelist(document.querySelectorAll(".content"));

// return is undefined.
ax5.util.isUndefined();

// return is undefined|''|null.
ax5.util.isNothing();

// return is Date
ax5.util.isDate();

```

## ax5.util.isDateFormat
`ax5.util.isDateFormat(String)`

```js
console.log(ax5.util.isDateFormat('20160101')); // true
console.log(ax5.util.isDateFormat('2016*01*01')); // true
console.log(ax5.util.isDateFormat('20161132')); // false
```

---


# Object
## ax5.util.filter
The first item is delivered to the second argument of the filter function. The second argument is an anonymous function, the result is True, the items will be collected.
```js
var result, aarray = [5, 4, 3, 2, 1];

result = ax5.util.filter(aarray, function () {
    return this % 2;
});
console.log(result);

var list = [
    {isdel: 1, name: "ax5-1"}, {name: "ax5-2"}, {
        isdel: 1,
        name: "ax5-3"
    }, {name: "ax5-4"}, {name: "ax5-5"}
];
result = ax5.util.filter(list, function () {
    return (this.isdel != 1);
});
console.log(JSON.stringify(result));
```

---

## ax5.util.search
It returns the first item of the result of the function is True.
```js
var a = ["A", "X", "5"];
var idx = ax5.util.search(a, function () {
    return this == "X";
});
console.log(a[idx]);

idx = ax5.util.search(a, function () {
    return this == "B";
});
console.log(idx);<commit_msg>ax5select<commit_after># Type

## ax5.util.getType
Return argument object type
```js
ax5.util.getType(1); // "number"
ax5.util.getType("1"); // "string"
ax5.util.getType([0, 1, 2]); // "array"
ax5.util.getType({a: 1}); // "object"
ax5.util.getType(function () {}); // "function"
ax5.util.getType(document.querySelectorAll("div")); // "nodelist"
ax5.util.getType(document.createDocumentFragment()); // "fragment"
```
Javascript object type name is not clear. so util.getType method very useful.

---
f
## ax5.util.is(Type)
Return argument object type is [type] result.
```js
// return is window.
ax5.util.isWindow(window);

// return is element.
ax5.util.isElement(document.getElementById("#ax5-util-is-type"));

// return is Object.
ax5.util.isObject({});

// return is Array.
ax5.util.isArray([]);

// return is Functon.
ax5.util.isFunction(new Function);

// return is String.
ax5.util.isString('');

// return is Number.
ax5.util.isNumber(1);

// return is nodeList.
ax5.util.isNodelist(document.querySelectorAll(".content"));

// return is undefined.
ax5.util.isUndefined();

// return is undefined|''|null.
ax5.util.isNothing();

// return is Date
ax5.util.isDate();

```

## ax5.util.isDateFormat
`ax5.util.isDateFormat(String)`

```js
console.log(ax5.util.isDateFormat('20160101')); // true
console.log(ax5.util.isDateFormat('2016*01*01')); // true
console.log(ax5.util.isDateFormat('20161132')); // false
```

---


# Object
## ax5.util.filter
The first item is delivered to the second argument of the filter function. The second argument is an anonymous function, the result is True, the items will be collected.
```js
var result, aarray = [5, 4, 3, 2, 1];

result = ax5.util.filter(aarray, function () {
    return this % 2;
});
console.log(result);

var list = [
    {isdel: 1, name: "ax5-1"}, {name: "ax5-2"}, {
        isdel: 1,
        name: "ax5-3"
    }, {name: "ax5-4"}, {name: "ax5-5"}
];
result = ax5.util.filter(list, function () {
    return (this.isdel != 1);
});
console.log(JSON.stringify(result));

var filObject = {a:1, s:"string", oa:{pickup:true, name:"AXISJ"}, os:{pickup:true, name:"AX5"}};
result = ax5.util.filter( filObject, function(){
	return this.pickup;
});
console.log( ax5.util.toJson(result) );
// [{"pickup": , "name": "AXISJ"}, {"pickup": , "name": "AX5"}]
```

---

## ax5.util.search
It returns the first item of the result of the function is True.
```js
var a = ["A", "X", "5"];
var idx = ax5.util.search(a, function () {
    return this == "X";
});
console.log(a[idx]);

idx = ax5.util.search(a, function () {
    return this == "B";
});
console.log(idx);
{'fraction_non_alphanumeric': 0.20182555780933062, 'fraction_numerical': 0.03488843813387424, 'mean_word_length': 3.9015904572564613, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3461442', 'n_tokens_mistral': 1852, 'n_tokens_neox': 1795, 'n_words': 433}