(that, value, encodingOrOffset, length)
| 1991 | }; |
| 1992 | |
| 1993 | function from (that, value, encodingOrOffset, length) { |
| 1994 | if (typeof value === 'number') { |
| 1995 | throw new TypeError('"value" argument must not be a number') |
| 1996 | } |
| 1997 | |
| 1998 | if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { |
| 1999 | return fromArrayBuffer(that, value, encodingOrOffset, length) |
| 2000 | } |
| 2001 | |
| 2002 | if (typeof value === 'string') { |
| 2003 | return fromString(that, value, encodingOrOffset) |
| 2004 | } |
| 2005 | |
| 2006 | return fromObject(that, value) |
| 2007 | } |
| 2008 | |
| 2009 | /** |
| 2010 | * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError |
no test coverage detected