JSPM

  • Created
  • Published
  • Downloads 17516
  • Score
    100M100P100Q131245F
  • License MIT

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

Package Exports

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

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

Enhanced utils

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

API

Full API Documents is here: Docs

newFunction

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

create a function via string.

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);
 }"
*/

defineProperty

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

Define a property on the object. move to inherits-ex package.

usage

const defineProperty = require('util-ex/lib/defineProperty')

let propValue = ''
const obj = {}

defineProperty(obj, 'prop', 'simpleValue')
defineProperty(obj, 'prop', undefined, {
  get() {return propValue}
  set(value) {propValue = value}
})