HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/farhangmoaser/web/node_modules/as-array/README.md
# as-array

Simple utility to make arrays of values that may also be scalar, so that they can be processed uniformly.  i.e.


```javascript
asArray(undefined) // === []
asArray(null) // === [null]
asArray('a') // === ['a']
asArray(['a']) // === ['a']
```

## Example

```javascript
function capitalizeWords(words) {
  return asArray(words).map(function(word) {
    return word[0].toUpperCase() + word.slice(1);
  });
}

capitalizeWords('test') // === ['test']
capitalizeWords(['this', 'is', 'a', 'test']) // === ['this', 'is', 'a', 'test']
```