Question: is there any function or any fast way to check if some value in our object startsWith e.g **asd**

Example:

```
let obj = { 
   'child' : {
      'child_key': 'asdfghhj'
    },
    'free': 'notasd',
    'with': 'asdhaheg'
  }

// check here if our obj has value that startsWith('asd')

```

Regards

Answer: 
You can recursively iterate object properties and check if property starts with `prefix` using [`find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) function:

```
function hasPropertyStartingWith(obj, prefix) {
  return !!Object.keys(obj).find(key => {
    if (typeof obj[key] === 'object') {
      return hasPropertyStartingWith(obj[key], prefix)
    }
    if (typeof obj[key] === 'string') {
      return obj[key].startsWith(prefix)
    }
    return false
  })
}

console.log(hasPropertyStartingWith(obj, 'asd'))

```
You may get away with something as simple as using a RegExp on a JSON string, something like

```js
var obj = {
  'child': {
    'child_key': 'asdfghhj'
  },
  'free': 'notasd',
  'with': 'asdhaheg'
};

function customStartsWith(obj, prefix) {
  return new RegExp(':"' + prefix + '[\\s\\S]*?"').test(JSON.stringify(obj));
}

console.log('obj, "asd":', customStartsWith(obj, 'asd'));
console.log('obj, "hello":', customStartsWith(obj, 'hello'));
console.log('null, "":', customStartsWith(null, ''));
console.log('undefined, "":', customStartsWith(undefined, ''));
console.log('"test", "te":', customStartsWith('test', 'te'));
console.log('12.5, 1:', customStartsWith(12.5, 1));
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.js"></script>
```

Update: Another recursive object walker that will work in a shimmed environment. This is just an example and it is easily customised.

```js
var walk = returnExports;
var obj = {
  'child': {
    'child_key': 'asdfghhj'
  },
  'free': 'notasd',
  'with': 'asdhaheg'
};

function customStartsWith(obj, prefix) {
  var found = false;
  walk(obj, Object.keys, function(value) {
    if (typeof value === 'string' && value.startsWith(prefix)) {
      found = true;
      walk.BREAK;
    }
  });
  return found;
}

console.log('obj, "asd":', customStartsWith(obj, 'asd'));
console.log('obj, "hello":', customStartsWith(obj, 'hello'));
console.log('null, "":', customStartsWith(null, ''));
console.log('undefined, "":', customStartsWith(undefined, ''));
console.log('"test", "te":', customStartsWith('test', 'te'));
console.log('12.5, 1:', customStartsWith(12.5, 1));
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.js"></script>
<script src="https://rawgithub.com/Xotic750/object-walk-x/master/lib/object-walk-x.js"></script>
```