2.0.3 • Published 7 years ago

safe-to-string-x v2.0.3

Weekly downloads
367
License
MIT
Repository
github
Last release
7 years ago

safe-to-string-x

DEPRECATED: Moved to https://github.com/Xotic750/to-string-symbols-supported-x

See: to-string-x
Version: 2.0.3
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exportsstring

DEPRECATED: Moved to https://github.com/Xotic750/to-string-symbols-supported-x to have a less confusing module name.

The abstract operation ToString converts argument to a value of type String, however the specification states that if the argument is a Symbol then a 'TypeError' is thrown. This version also allows Symbols be converted to a string. Other uncoercible exotics will still throw though.

Kind: Exported member
Returns: string - The converted value.

ParamTypeDescription
value*The value to convert to a string.

Example

var safeToString = require('safe-to-string-x');

safeToString(); // 'undefined'
safeToString(null); // 'null'
safeToString('abc'); // 'abc'
safeToString(true); // 'true'
safeToString(Symbol('foo')); // 'Symbol(foo)'
safeToString(Symbol.iterator); // 'Symbol(Symbol.iterator)'
safeToString(Object(Symbol.iterator)); // 'Symbol(Symbol.iterator)'
safeToString(Object.create(null)); // TypeError
2.0.3

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.11

8 years ago

1.1.10

8 years ago

1.1.9

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago