mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 02:20:08 +00:00
bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5817270787
commit
a304b7d91f
13
object.js
13
object.js
@ -268,19 +268,28 @@ function(base, obj, non_strict){
|
||||
|
||||
// like Object.create(..) but also handles callable objects correctly...
|
||||
//
|
||||
// XXX add ability to name the resulting function...
|
||||
var create =
|
||||
module.create =
|
||||
function(obj){
|
||||
// name given...
|
||||
if(typeof(obj) == 'string' && arguments.length > 1){
|
||||
var name
|
||||
;[name, obj] = arguments }
|
||||
// calable...
|
||||
if(typeof(obj) == 'function'){
|
||||
var func = function(){
|
||||
return Object.hasOwnProperty.call(func, '__call__') ?
|
||||
func.__call__.call(func, ...arguments)
|
||||
return '__call__' in func ?
|
||||
func.__call__(this, ...arguments)
|
||||
: 'call' in obj ?
|
||||
obj.call(func, ...arguments)
|
||||
// NOTE: if obj does not inherit from Function .call
|
||||
// might not be available...
|
||||
: Function.prototype.call.call(obj, func, ...arguments) }
|
||||
|
||||
// XXX set the name....
|
||||
// XXX
|
||||
|
||||
func.__proto__ = obj
|
||||
// XXX not sure about this yet...
|
||||
Object.defineProperty(func, 'toString', {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-object",
|
||||
"version": "5.5.0",
|
||||
"version": "5.5.1",
|
||||
"description": "",
|
||||
"main": "object.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user