public static Object[] getPropertyIds(Scriptable obj) { return ScriptableObject.getPropertyIds(obj); }
public TryExtensionsResult tryExtensions(String id, ModuleScope thisObj) { File cwdFile = getBasePathForModule(thisObj); NativeObject extensions = ScriptableObject.getTypedProperty(this, "extensions", NativeObject.class); Object[] propertyIds = ScriptableObject.getPropertyIds(extensions); if (!(id.startsWith("./") || id.startsWith("../") || id.startsWith("/"))) { return null; } for (Object extension : propertyIds) { String extensionAsString = (String) extension; File file; if ( cwdFile != null ) { file = new File(FilenameUtils.concat(cwdFile.getAbsolutePath(), id + extensionAsString)); /* Case of ./ only where we need to add index.js */ if (!file.exists()) { file = new File(FilenameUtils.concat(cwdFile.getAbsolutePath(), id + "index" + extensionAsString)); } } else { /* Case of /a/b/c.js */ file = new File(id + extensionAsString); } if ( file.exists() ) { Function value = ScriptableObject.getTypedProperty(extensions, extensionAsString, Function.class); return new TryExtensionsResult(extensionAsString, value, file); } } return null; }
private void copyKeys(Scriptable oldExport, Scriptable newExport) { for (Object o : ScriptableObject.getPropertyIds(newExport)) { String name = o.toString(); ScriptableObject.putProperty(oldExport, name, ScriptableObject.getProperty(newExport, name)); } ScriptableObject.putProperty(oldExport, "prototype", ScriptableObject.getProperty(newExport, "prototype")); } }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
for (Object id: ScriptableObject.getPropertyIds((Scriptable) properties)) { b.addProperty(id.toString());
Object[] ids = ScriptableObject.getPropertyIds(envHash); environment = new String[ids.length]; for (int i = 0; i != ids.length; ++i) {
Object[] ids = ScriptableObject.getPropertyIds(envHash); environment = new String[ids.length]; for (int i = 0; i != ids.length; ++i) {