to-string

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
10
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
4 KB
Returns the string representation of the given value.
1 contributor
Install to-string as a package?
Copied
npm i @bit/justin-capalbo.ramda.to-string
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
toString (
val:*
) : String

Returns the string representation of the given value. eval'ing the output should result in a value equivalent to the input value. Many of the built-in toString methods do not satisfy this requirement.

If the given value is an [object Object] with a toString method other than Object.prototype.toString, this method is invoked with no arguments to produce the return value. This means user-defined constructor functions can provide a suitable toString method. For example:

function Point(x, y) {
  this.x = x;
  this.y = y;
}

Point.prototype.toString = function() {
  return 'new Point(' + this.x + ', ' + this.y + ')';
};

R.toString(new Point(1, 2)); //=> 'new Point(1, 2)'
Example
R.toString(42); //=> '42'
     R.toString('abc'); //=> '"abc"'
     R.toString([1, 2, 3]); //=> '[1, 2, 3]'
     R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}'
     R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")'
Argument
val: *
Returns
String

Help and resources