https://github.com/levp/as-key
https://github.com/levp/as-key
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/levp/as-key
- Owner: levp
- Created: 2018-06-15T01:44:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-15T02:02:13.000Z (about 8 years ago)
- Last Synced: 2025-10-20T12:59:12.482Z (8 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# as-key
Convert any value to a string – except for symbols.
## Description
Behaves similar to a universal to-string-conversion tool, except that it doesn't degrade symbols into strings – which
makes them lose their unique indexing ability when used as object keys.
Works with any special values such as `null` and `undefined`, objects, primitives, and even objects without
`toString` methods (e.g. `Object.create(null)`).
## Installing
npm: `npm i try-with`
yarn: `yarn add try-with`
```$javascript
const asKey = require('askey');
```
## API
```
function asKey(value: any): string | symbol;
```
## License
ISC