2.0.3 • Published 8 years ago

safe-to-string-x v2.0.3

Weekly downloads
367
License
MIT
Repository
github
Last release
8 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

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.11

9 years ago

1.1.10

9 years ago

1.1.9

9 years ago

1.1.8

10 years ago

1.1.7

10 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago