C# Class Jurassic.TypeUtilities

Contains type-related functionality that isn't conversion or comparison.
Afficher le fichier Open project: paulbartrum/jurassic Class Usage Examples

Méthodes publiques

Méthode Description
Add ( object left, object right ) : object

Adds two objects together, as if by the javascript addition operator.

EnumeratePropertyNames ( ScriptEngine engine, object obj ) : IEnumerable

Enumerates the names of the enumerable properties on the given object, including properties defined on the object's prototype. Used by the for-in statement.

GetIterator ( ScriptEngine engine, ObjectInstance iterable ) : ObjectInstance

Converts an iteratable object into a iterator by looking up the @@iterator property, then calling that value as a function.

IsNegativeZero ( double value ) : bool

Determines if the given number is negative zero.

IsPositiveZero ( double value ) : bool

Determines if the given number is positive zero.

IsPrimitive ( object value ) : bool

Determines if the given value is a supported JavaScript primitive.

IsPrimitiveOrObject ( object value ) : bool

Determines if the given value is a supported JavaScript primitive or derives from ObjectInstance.

IsRegularExpression ( object value ) : bool

Determines if the given value is a regular expression.

Iterate ( ScriptEngine engine, ObjectInstance iterator ) : IEnumerable

Iterate over the values in an iterator.

TypeOf ( object obj ) : string

Gets the type name for the given object. Used by the typeof operator.

VerifyThisObject ( ScriptEngine engine, object value, string functionName ) : void

Throws a TypeError when the given value is null or undefined.

Private Methods

Méthode Description
IsNumeric ( object obj ) : bool

Returns true if the given value is a supported numeric type.

IsString ( object obj ) : bool

Returns true if the given value is a supported string type.

IsUndefined ( object obj ) : bool

Returns true if the given value is undefined.

NormalizeValue ( object obj ) : object

Converts the given value into a standard .NET type, suitable for returning from an API.

SliceArray ( object args, int offset ) : object[]

Utility method for create a slice of an array.

Method Details

Add() public static méthode

Adds two objects together, as if by the javascript addition operator.
public static Add ( object left, object right ) : object
left object The left hand side operand.
right object The right hand side operand.
Résultat object

EnumeratePropertyNames() public static méthode

Enumerates the names of the enumerable properties on the given object, including properties defined on the object's prototype. Used by the for-in statement.
public static EnumeratePropertyNames ( ScriptEngine engine, object obj ) : IEnumerable
engine ScriptEngine The script engine used to convert the given value to an object.
obj object The object to enumerate.
Résultat IEnumerable

GetIterator() public static méthode

Converts an iteratable object into a iterator by looking up the @@iterator property, then calling that value as a function.
public static GetIterator ( ScriptEngine engine, ObjectInstance iterable ) : ObjectInstance
engine ScriptEngine The script engine.
iterable Jurassic.Library.ObjectInstance The object to get a iterator from.
Résultat Jurassic.Library.ObjectInstance

IsNegativeZero() public static méthode

Determines if the given number is negative zero.
public static IsNegativeZero ( double value ) : bool
value double The value to test.
Résultat bool

IsPositiveZero() public static méthode

Determines if the given number is positive zero.
public static IsPositiveZero ( double value ) : bool
value double The value to test.
Résultat bool

IsPrimitive() public static méthode

Determines if the given value is a supported JavaScript primitive.
public static IsPrimitive ( object value ) : bool
value object The value to test.
Résultat bool

IsPrimitiveOrObject() public static méthode

Determines if the given value is a supported JavaScript primitive or derives from ObjectInstance.
public static IsPrimitiveOrObject ( object value ) : bool
value object The value to test.
Résultat bool

IsRegularExpression() public static méthode

Determines if the given value is a regular expression.
public static IsRegularExpression ( object value ) : bool
value object The value to test.
Résultat bool

Iterate() public static méthode

Iterate over the values in an iterator.
public static Iterate ( ScriptEngine engine, ObjectInstance iterator ) : IEnumerable
engine ScriptEngine The script engine.
iterator Jurassic.Library.ObjectInstance The iterator object. Must contain a next function.
Résultat IEnumerable

TypeOf() public static méthode

Gets the type name for the given object. Used by the typeof operator.
public static TypeOf ( object obj ) : string
obj object The object to get the type name for.
Résultat string

VerifyThisObject() public static méthode

Throws a TypeError when the given value is null or undefined.
public static VerifyThisObject ( ScriptEngine engine, object value, string functionName ) : void
engine ScriptEngine The associated script engine.
value object The value to check.
functionName string The name of the function which is doing the check.
Résultat void