JSPM

  • Created
  • Published
  • Downloads 17357
  • Score
    100M100P100Q132812F
  • License MIT

Browser-friendly enhanced util fully compatible with standard node.js

Package Exports

  • util-ex
  • util-ex/lib/_create-function
  • util-ex/lib/_extend
  • util-ex/lib/clone-object
  • util-ex/lib/defineProperty
  • util-ex/lib/extend
  • util-ex/lib/format
  • util-ex/lib/get-non-enumerable-names
  • util-ex/lib/inject
  • util-ex/lib/injectMethod
  • util-ex/lib/injectMethods
  • util-ex/lib/is/empty
  • util-ex/lib/is/empty-function
  • util-ex/lib/is/empty-object
  • util-ex/lib/is/in
  • util-ex/lib/is/string/float
  • util-ex/lib/is/string/function
  • util-ex/lib/is/string/int
  • util-ex/lib/is/type/arguments
  • util-ex/lib/is/type/array
  • util-ex/lib/is/type/boolean
  • util-ex/lib/is/type/buffer
  • util-ex/lib/is/type/date
  • util-ex/lib/is/type/function
  • util-ex/lib/is/type/null-or-undefined
  • util-ex/lib/is/type/number
  • util-ex/lib/is/type/object
  • util-ex/lib/is/type/regexp
  • util-ex/lib/is/type/string
  • util-ex/lib/is/type/undefined
  • util-ex/lib/new-function
  • util-ex/lib/object/map

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (util-ex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

util-ex Build Status npm downloads license

Browser-friendly enhanced util fully compatible with standard node.js util

This package modifies and enhances the standard util from node.js

API

definePropery

definePropery(object, key, value[, aOptions])

Define a porperty on the object.

usage

definePropery = require 'util-ex/lib/definePropery'

propValue = ''
definePropery this, 'prop', 'simpleValue'
definePropery this, 'prop', undefined,
  get: -> propValue
  set: (value) -> propValue = value

newFunction

newFunction(name, arguments, body[, scope[, values]])
newFunction(functionString[, scope[, values]])

create a function via sring.

newFunction = require('util-ex/lib/new-function')

var fn = newFunction('yourFuncName', ['arg1', 'arg2'], 'return log(arg1+arg2);', {log:console.log})
newFunction('function yourFuncName(){}')
newFunction('function yourFuncName(arg1, arg2){return log(arg1+arg2);}', {log:console.log})
newFunction('function yourFuncName(arg1, arg2){return log(arg1+arg2);}', ['log'], [console.log])

//fn.toString() is :
 "function yourFuncName(arg1, arg2) {
    return log(arg1+arg2);
 }"