Giter VIP home page Giter VIP logo

es5-ext's Introduction

Build status Tests coverage npm version

es5-ext

ECMAScript 5 extensions

(with respect to ECMAScript 6 standard)

Shims for upcoming ES6 standard and other goodies implemented strictly with ECMAScript conventions in mind.

It's designed to be used in compliant ECMAScript 5 or ECMAScript 6 environments. Older environments are not supported, although most of the features should work with correct ECMAScript 5 shim on board.

When used in ECMAScript 6 environment, native implementation (if valid) takes precedence over shims.

Installation

npm install es5-ext

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack

Usage

ECMAScript 6 features

You can force ES6 features to be implemented in your environment, e.g. following will assign from function to Array (only if it's not implemented already).

require("es5-ext/array/from/implement");
Array.from("foo"); // ['f', 'o', 'o']

You can also access shims directly, without fixing native objects. Following will return native Array.from if it's available and fallback to shim if it's not.

var aFrom = require("es5-ext/array/from");
aFrom("foo"); // ['f', 'o', 'o']

If you want to use shim unconditionally (even if native implementation exists) do:

var aFrom = require("es5-ext/array/from/shim");
aFrom("foo"); // ['f', 'o', 'o']
List of ES6 shims

It's about properties introduced with ES6 and those that have been updated in new spec.

  • Array.from -> require('es5-ext/array/from')
  • Array.of -> require('es5-ext/array/of')
  • Array.prototype.concat -> require('es5-ext/array/#/concat')
  • Array.prototype.copyWithin -> require('es5-ext/array/#/copy-within')
  • Array.prototype.entries -> require('es5-ext/array/#/entries')
  • Array.prototype.fill -> require('es5-ext/array/#/fill')
  • Array.prototype.filter -> require('es5-ext/array/#/filter')
  • Array.prototype.find -> require('es5-ext/array/#/find')
  • Array.prototype.findIndex -> require('es5-ext/array/#/find-index')
  • Array.prototype.keys -> require('es5-ext/array/#/keys')
  • Array.prototype.map -> require('es5-ext/array/#/map')
  • Array.prototype.slice -> require('es5-ext/array/#/slice')
  • Array.prototype.splice -> require('es5-ext/array/#/splice')
  • Array.prototype.values -> require('es5-ext/array/#/values')
  • Array.prototype[@@iterator] -> require('es5-ext/array/#/@@iterator')
  • Math.acosh -> require('es5-ext/math/acosh')
  • Math.asinh -> require('es5-ext/math/asinh')
  • Math.atanh -> require('es5-ext/math/atanh')
  • Math.cbrt -> require('es5-ext/math/cbrt')
  • Math.clz32 -> require('es5-ext/math/clz32')
  • Math.cosh -> require('es5-ext/math/cosh')
  • Math.exmp1 -> require('es5-ext/math/expm1')
  • Math.fround -> require('es5-ext/math/fround')
  • Math.hypot -> require('es5-ext/math/hypot')
  • Math.imul -> require('es5-ext/math/imul')
  • Math.log1p -> require('es5-ext/math/log1p')
  • Math.log2 -> require('es5-ext/math/log2')
  • Math.log10 -> require('es5-ext/math/log10')
  • Math.sign -> require('es5-ext/math/sign')
  • Math.signh -> require('es5-ext/math/signh')
  • Math.tanh -> require('es5-ext/math/tanh')
  • Math.trunc -> require('es5-ext/math/trunc')
  • Number.EPSILON -> require('es5-ext/number/epsilon')
  • Number.MAX_SAFE_INTEGER -> require('es5-ext/number/max-safe-integer')
  • Number.MIN_SAFE_INTEGER -> require('es5-ext/number/min-safe-integer')
  • Number.isFinite -> require('es5-ext/number/is-finite')
  • Number.isInteger -> require('es5-ext/number/is-integer')
  • Number.isNaN -> require('es5-ext/number/is-nan')
  • Number.isSafeInteger -> require('es5-ext/number/is-safe-integer')
  • Object.assign -> require('es5-ext/object/assign')
  • Object.keys -> require('es5-ext/object/keys')
  • Object.setPrototypeOf -> require('es5-ext/object/set-prototype-of')
  • Promise.prototype.finally -> require('es5-ext/promise/#/finally')
  • RegExp.prototype.match -> require('es5-ext/reg-exp/#/match')
  • RegExp.prototype.replace -> require('es5-ext/reg-exp/#/replace')
  • RegExp.prototype.search -> require('es5-ext/reg-exp/#/search')
  • RegExp.prototype.split -> require('es5-ext/reg-exp/#/split')
  • RegExp.prototype.sticky -> Implement with require('es5-ext/reg-exp/#/sticky/implement'), use as function with require('es5-ext/reg-exp/#/is-sticky')
  • RegExp.prototype.unicode -> Implement with require('es5-ext/reg-exp/#/unicode/implement'), use as function with require('es5-ext/reg-exp/#/is-unicode')
  • String.fromCodePoint -> require('es5-ext/string/from-code-point')
  • String.raw -> require('es5-ext/string/raw')
  • String.prototype.codePointAt -> require('es5-ext/string/#/code-point-at')
  • String.prototype.contains -> require('es5-ext/string/#/contains')
  • String.prototype.endsWith -> require('es5-ext/string/#/ends-with')
  • String.prototype.normalize -> require('es5-ext/string/#/normalize')
  • String.prototype.repeat -> require('es5-ext/string/#/repeat')
  • String.prototype.startsWith -> require('es5-ext/string/#/starts-with')
  • String.prototype[@@iterator] -> require('es5-ext/string/#/@@iterator')

Non ECMAScript standard features

es5-ext provides also other utils, and implements them as if they were proposed for a standard. It mostly offers methods (not functions) which can directly be assigned to native prototypes:

Object.defineProperty(Function.prototype, "partial", {
  value: require("es5-ext/function/#/partial"),
  configurable: true,
  enumerable: false,
  writable: true
});
Object.defineProperty(Array.prototype, "flatten", {
  value: require("es5-ext/array/#/flatten"),
  configurable: true,
  enumerable: false,
  writable: true
});
Object.defineProperty(String.prototype, "capitalize", {
  value: require("es5-ext/string/#/capitalize"),
  configurable: true,
  enumerable: false,
  writable: true
});

See es5-extend, a great utility that automatically will extend natives for you.

Important: Remember to not extend natives in scope of generic reusable packages (e.g. ones you intend to publish to npm). Extending natives is fine only if you're the owner of the global scope, so e.g. in final project you lead development of.

When you're in situation when native extensions are not good idea, then you should use methods indirectly:

var flatten = require("es5-ext/array/#/flatten");

flatten.call([1, [2, [3, 4]]]); // [1, 2, 3, 4]

for better convenience you can turn methods into functions:

var call = Function.prototype.call;
var flatten = call.bind(require("es5-ext/array/#/flatten"));

flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4]

You can configure custom toolkit (like underscorejs), and use it throughout your application

var util = {};
util.partial = call.bind(require("es5-ext/function/#/partial"));
util.flatten = call.bind(require("es5-ext/array/#/flatten"));
util.startsWith = call.bind(require("es5-ext/string/#/starts-with"));

util.flatten([1, [2, [3, 4]]]); // [1, 2, 3, 4]

As with native ones most methods are generic and can be run on any type of object.

API

Global extensions

global (es5-ext/global)

Object that represents global scope

Array Constructor extensions

from(arrayLike[, mapFn[, thisArg]]) (es5-ext/array/from)

Introduced with ECMAScript 6. Returns array representation of iterable or arrayLike. If arrayLike is an instance of array, its copy is returned.

generate([length[, …fill]]) (es5-ext/array/generate)

Generate an array of pre-given length built of repeated arguments.

isPlainArray(x) (es5-ext/array/is-plain-array)

Returns true if object is plain array (not instance of one of the Array's extensions).

of([…items]) (es5-ext/array/of)

Introduced with ECMAScript 6. Create an array from given arguments.

toArray(obj) (es5-ext/array/to-array)

Returns array representation of obj. If obj is already an array, obj is returned back.

validArray(obj) (es5-ext/array/valid-array)

Returns obj if it's an array, otherwise throws TypeError

Array Prototype extensions

arr.binarySearch(compareFn) (es5-ext/array/#/binary-search)

In sorted list search for index of item for which compareFn returns value closest to 0. It's variant of binary search algorithm

arr.clear() (es5-ext/array/#/clear)

Clears the array

arr.compact() (es5-ext/array/#/compact)

Returns a copy of the context with all non-values (null or undefined) removed.

arr.concat() (es5-ext/array/#/concat)

Updated with ECMAScript 6. ES6's version of concat. Supports isConcatSpreadable symbol, and returns array of same type as the context.

arr.contains(searchElement[, position]) (es5-ext/array/#/contains)

Whether list contains the given value.

arr.copyWithin(target, start[, end]) (es5-ext/array/#/copy-within)

Introduced with ECMAScript 6.

arr.diff(other) (es5-ext/array/#/diff)

Returns the array of elements that are present in context list but not present in other list.

arr.eIndexOf(searchElement[, fromIndex]) (es5-ext/array/#/e-index-of)

egal version of indexOf method. SameValueZero logic is used for comparision

arr.eLastIndexOf(searchElement[, fromIndex]) (es5-ext/array/#/e-last-index-of)

egal version of lastIndexOf method. SameValueZero logic is used for comparision

arr.entries() (es5-ext/array/#/entries)

Introduced with ECMAScript 6. Returns iterator object, which traverses the array. Each value is represented with an array, where first value is an index and second is corresponding to index value.

arr.exclusion([…lists]]) (es5-ext/array/#/exclusion)

Returns the array of elements that are found only in one of the lists (either context list or list provided in arguments).

arr.fill(value[, start, end]) (es5-ext/array/#/fill)

Introduced with ECMAScript 6.

arr.filter(callback[, thisArg]) (es5-ext/array/#/filter)

Updated with ECMAScript 6. ES6's version of filter, returns array of same type as the context.

arr.find(predicate[, thisArg]) (es5-ext/array/#/find)

Introduced with ECMAScript 6. Return first element for which given function returns true

arr.findIndex(predicate[, thisArg]) (es5-ext/array/#/find-index)

Introduced with ECMAScript 6. Return first index for which given function returns true

arr.first() (es5-ext/array/#/first)

Returns value for first defined index

arr.firstIndex() (es5-ext/array/#/first-index)

Returns first declared index of the array

arr.flatten() (es5-ext/array/#/flatten)

Returns flattened version of the array

arr.forEachRight(cb[, thisArg]) (es5-ext/array/#/for-each-right)

forEach starting from last element

arr.group(cb[, thisArg]) (es5-ext/array/#/group)

Group list elements by value returned by cb function

arr.indexesOf(searchElement[, fromIndex]) (es5-ext/array/#/indexes-of)

Returns array of all indexes of given value

arr.intersection([…lists]) (es5-ext/array/#/intersection)

Computes the array of values that are the intersection of all lists (context list and lists given in arguments)

arr.isCopy(other) (es5-ext/array/#/is-copy)

Returns true if both context and other lists have same content

arr.isUniq() (es5-ext/array/#/is-uniq)

Returns true if all values in array are unique

arr.keys() (es5-ext/array/#/keys)

Introduced with ECMAScript 6. Returns iterator object, which traverses all array indexes.

arr.last() (es5-ext/array/#/last)

Returns value of last defined index

arr.lastIndex() (es5-ext/array/#/last)

Returns last defined index of the array

arr.map(callback[, thisArg]) (es5-ext/array/#/map)

Updated with ECMAScript 6. ES6's version of map, returns array of same type as the context.

arr.remove(value[, …valuen]) (es5-ext/array/#/remove)

Remove values from the array

arr.separate(sep) (es5-ext/array/#/separate)

Returns array with items separated with sep value

arr.slice(callback[, thisArg]) (es5-ext/array/#/slice)

Updated with ECMAScript 6. ES6's version of slice, returns array of same type as the context.

arr.someRight(cb[, thisArg]) (es5-ext/array/#/someRight)

some starting from last element

arr.splice(callback[, thisArg]) (es5-ext/array/#/splice)

Updated with ECMAScript 6. ES6's version of splice, returns array of same type as the context.

arr.uniq() (es5-ext/array/#/uniq)

Returns duplicate-free version of the array

arr.values() (es5-ext/array/#/values)

Introduced with ECMAScript 6. Returns iterator object which traverses all array values.

arr[@@iterator] (es5-ext/array/#/@@iterator)

Introduced with ECMAScript 6. Returns iterator object which traverses all array values.

Boolean Constructor extensions

isBoolean(x) (es5-ext/boolean/is-boolean)

Whether value is boolean

Date Constructor extensions

isDate(x) (es5-ext/date/is-date)

Whether value is date instance

validDate(x) (es5-ext/date/valid-date)

If given object is not date throw TypeError in other case return it.

Date Prototype extensions

date.copy(date) (es5-ext/date/#/copy)

Returns a copy of the date object

date.daysInMonth() (es5-ext/date/#/days-in-month)

Returns number of days of date's month

date.floorDay() (es5-ext/date/#/floor-day)

Sets the date time to 00:00:00.000

date.floorMonth() (es5-ext/date/#/floor-month)

Sets date day to 1 and date time to 00:00:00.000

date.floorYear() (es5-ext/date/#/floor-year)

Sets date month to 0, day to 1 and date time to 00:00:00.000

date.format(pattern) (es5-ext/date/#/format)

Formats date up to given string. Supported patterns:

  • %Y - Year with century, 1999, 2003
  • %y - Year without century, 99, 03
  • %m - Month, 01..12
  • %d - Day of the month 01..31
  • %H - Hour (24-hour clock), 00..23
  • %M - Minute, 00..59
  • %S - Second, 00..59
  • %L - Milliseconds, 000..999

Error Constructor extensions

custom(message/, code, ext/) (es5-ext/error/custom)

Creates custom error object, optinally extended with code and other extension properties (provided with ext object)

isError(x) (es5-ext/error/is-error)

Whether value is an error (instance of Error).

validError(x) (es5-ext/error/valid-error)

If given object is not error throw TypeError in other case return it.

Error Prototype extensions

err.throw() (es5-ext/error/#/throw)

Throws error

Function Constructor extensions

Some of the functions were inspired by Functional JavaScript project by Olivier Steele

constant(x) (es5-ext/function/constant)

Returns a constant function that returns pregiven argument

k(x)(y) =def x

identity(x) (es5-ext/function/identity)

Identity function. Returns first argument

i(x) =def x

invoke(name[, …args]) (es5-ext/function/invoke)

Returns a function that takes an object as an argument, and applies object's name method to arguments. name can be name of the method or method itself.

invoke(name, …args)(object, …args2) =def object[name](…args, …args2)

isArguments(x) (es5-ext/function/is-arguments)

Whether value is arguments object

isFunction(arg) (es5-ext/function/is-function)

Whether value is instance of function

noop() (es5-ext/function/noop)

No operation function

pluck(name) (es5-ext/function/pluck)

Returns a function that takes an object, and returns the value of its name property

pluck(name)(obj) =def obj[name]

validFunction(arg) (es5-ext/function/valid-function)

If given object is not function throw TypeError in other case return it.

Function Prototype extensions

Some of the methods were inspired by Functional JavaScript project by Olivier Steele

fn.compose([…fns]) (es5-ext/function/#/compose)

Applies the functions in reverse argument-list order.

f1.compose(f2, f3, f4)(…args) =def f1(f2(f3(f4(…arg))))

compose can also be used in plain function form as:

compose(f1, f2, f3, f4)(…args) =def f1(f2(f3(f4(…arg))))

fn.copy() (es5-ext/function/#/copy)

Produces copy of given function

fn.curry([n]) (es5-ext/function/#/curry)

Invoking the function returned by this function only n arguments are passed to the underlying function. If the underlying function is not saturated, the result is a function that passes all its arguments to the underlying function. If n is not provided then it defaults to context function length

f.curry(4)(arg1, arg2)(arg3)(arg4) =def f(arg1, args2, arg3, arg4)

fn.lock([…args]) (es5-ext/function/#/lock)

Returns a function that applies the underlying function to args, and ignores its own arguments.

f.lock(…args)(…args2) =def f(…args)

Named after it's counterpart in Google Closure

fn.not() (es5-ext/function/#/not)

Returns a function that returns boolean negation of value returned by underlying function.

f.not()(…args) =def !f(…args)

fn.partial([…args]) (es5-ext/function/#/partial)

Returns a function that when called will behave like context function called with initially passed arguments. If more arguments are suplilied, they are appended to initial args.

f.partial(…args1)(…args2) =def f(…args1, …args2)

fn.spread() (es5-ext/function/#/spread)

Returns a function that applies underlying function with first list argument

f.match()(args) =def f.apply(null, args)

fn.toStringTokens() (es5-ext/function/#/to-string-tokens)

Serializes function into two (arguments and body) string tokens. Result is plain object with args and body properties.

Math extensions

acosh(x) (es5-ext/math/acosh)

Introduced with ECMAScript 6.

asinh(x) (es5-ext/math/asinh)

Introduced with ECMAScript 6.

atanh(x) (es5-ext/math/atanh)

Introduced with ECMAScript 6.

cbrt(x) (es5-ext/math/cbrt)

Introduced with ECMAScript 6.

clz32(x) (es5-ext/math/clz32)

Introduced with ECMAScript 6.

cosh(x) (es5-ext/math/cosh)

Introduced with ECMAScript 6.

expm1(x) (es5-ext/math/expm1)

Introduced with ECMAScript 6.

fround(x) (es5-ext/math/fround)

Introduced with ECMAScript 6.

hypot([…values]) (es5-ext/math/hypot)

Introduced with ECMAScript 6.

imul(x, y) (es5-ext/math/imul)

Introduced with ECMAScript 6.

log1p(x) (es5-ext/math/log1p)

Introduced with ECMAScript 6.

log2(x) (es5-ext/math/log2)

Introduced with ECMAScript 6.

log10(x) (es5-ext/math/log10)

Introduced with ECMAScript 6.

sign(x) (es5-ext/math/sign)

Introduced with ECMAScript 6.

sinh(x) (es5-ext/math/sinh)

Introduced with ECMAScript 6.

tanh(x) (es5-ext/math/tanh)

Introduced with ECMAScript 6.

trunc(x) (es5-ext/math/trunc)

Introduced with ECMAScript 6.

Number Constructor extensions

EPSILON (es5-ext/number/epsilon)

Introduced with ECMAScript 6.

The difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 x 10-16.

isFinite(x) (es5-ext/number/is-finite)

Introduced with ECMAScript 6. Whether value is finite. Differs from global isNaN that it doesn't do type coercion.

isInteger(x) (es5-ext/number/is-integer)

Introduced with ECMAScript 6. Whether value is integer.

isNaN(x) (es5-ext/number/is-nan)

Introduced with ECMAScript 6. Whether value is NaN. Differs from global isNaN that it doesn't do type coercion.

isNumber(x) (es5-ext/number/is-number)

Whether given value is number

isSafeInteger(x) (es5-ext/number/is-safe-integer)

Introduced with ECMAScript 6.

MAX*SAFE_INTEGER *(es5-ext/number/max-safe-integer)_

Introduced with ECMAScript 6. The value of Number.MAX_SAFE_INTEGER is 9007199254740991.

MIN*SAFE_INTEGER *(es5-ext/number/min-safe-integer)_

Introduced with ECMAScript 6. The value of Number.MIN_SAFE_INTEGER is -9007199254740991 (253-1).

toInteger(x) (es5-ext/number/to-integer)

Converts value to integer

toPosInteger(x) (es5-ext/number/to-pos-integer)

Converts value to positive integer. If provided value is less than 0, then 0 is returned

toUint32(x) (es5-ext/number/to-uint32)

Converts value to unsigned 32 bit integer. This type is used for array lengths. See: http://www.2ality.com/2012/02/js-integers.html

Number Prototype extensions

num.pad(length[, precision]) (es5-ext/number/#/pad)

Pad given number with zeros. Returns string

Object Constructor extensions

assign(target, source[, …sourcen]) (es5-ext/object/assign)

Introduced with ECMAScript 6. Extend target by enumerable own properties of other objects. If properties are already set on target object, they will be overwritten.

clear(obj) (es5-ext/object/clear)

Remove all enumerable own properties of the object

compact(obj) (es5-ext/object/compact)

Returns copy of the object with all enumerable properties that have no falsy values

compare(obj1, obj2) (es5-ext/object/compare)

Universal cross-type compare function. To be used for e.g. array sort.

copy(obj) (es5-ext/object/copy)

Returns copy of the object with all enumerable properties.

copyDeep(obj) (es5-ext/object/copy-deep)

Returns deep copy of the object with all enumerable properties.

count(obj) (es5-ext/object/count)

Counts number of enumerable own properties on object

create(obj[, properties]) (es5-ext/object/create)

Object.create alternative that provides workaround for V8 issue.

When null is provided as a prototype, it's substituted with specially prepared object that derives from Object.prototype but has all Object.prototype properties shadowed with undefined.

It's quirky solution that allows us to have plain objects with no truthy properties but with turnable prototype.

Use only for objects that you plan to switch prototypes of and be aware of limitations of this workaround.

eq(x, y) (es5-ext/object/eq)

Whether two values are equal, using SameValueZero algorithm.

every(obj, cb[, thisArg[, compareFn]]) (es5-ext/object/every)

Analogous to Array.prototype.every. Returns true if every key-value pair in this object satisfies the provided testing function. Optionally compareFn can be provided which assures that keys are tested in given order. If provided compareFn is equal to true, then order is alphabetical (by key).

filter(obj, cb[, thisArg]) (es5-ext/object/filter)

Analogous to Array.prototype.filter. Returns new object with properites for which cb function returned truthy value.

firstKey(obj) (es5-ext/object/first-key)

Returns first enumerable key of the object, as keys are unordered by specification, it can be any key of an object.

flatten(obj) (es5-ext/object/flatten)

Returns new object, with flatten properties of input object

flatten({ a: { b: 1 }, c: { d: 1 } }) =def { b: 1, d: 1 }

forEach(obj, cb[, thisArg[, compareFn]]) (es5-ext/object/for-each)

Analogous to Array.prototype.forEach. Calls a function for each key-value pair found in object Optionally compareFn can be provided which assures that properties are iterated in given order. If provided compareFn is equal to true, then order is alphabetical (by key).

getPropertyNames() (es5-ext/object/get-property-names)

Get all (not just own) property names of the object

is(x, y) (es5-ext/object/is)

Whether two values are equal, using SameValue algorithm.

isArrayLike(x) (es5-ext/object/is-array-like)

Whether object is array-like object

isCopy(x, y) (es5-ext/object/is-copy)

Two values are considered a copy of same value when all of their own enumerable properties have same values.

isCopyDeep(x, y) (es5-ext/object/is-copy-deep)

Deep comparision of objects

isEmpty(obj) (es5-ext/object/is-empty)

True if object doesn't have any own enumerable property

isObject(arg) (es5-ext/object/is-object)

Whether value is not primitive

isPlainObject(arg) (es5-ext/object/is-plain-object)

Whether object is plain object, its protototype should be Object.prototype and it cannot be host object.

keyOf(obj, searchValue) (es5-ext/object/key-of)

Search object for value

keys(obj) (es5-ext/object/keys)

Updated with ECMAScript 6. ES6's version of keys, doesn't throw on primitive input

map(obj, cb[, thisArg]) (es5-ext/object/map)

Analogous to Array.prototype.map. Creates a new object with properties which values are results of calling a provided function on every key-value pair in this object.

mapKeys(obj, cb[, thisArg]) (es5-ext/object/map-keys)

Create new object with same values, but remapped keys

mixin(target, source) (es5-ext/object/mixin)

Extend target by all own properties of other objects. Properties found in both objects will be overwritten (unless they're not configurable and cannot be overwritten). It was for a moment part of ECMAScript 6 draft.

mixinPrototypes(target, …source]) (es5-ext/object/mixin-prototypes)

Extends target, with all source and source's prototype properties. Useful as an alternative for setPrototypeOf in environments in which it cannot be shimmed (no __proto__ support).

normalizeOptions(options) (es5-ext/object/normalize-options)

Normalizes options object into flat plain object.

Useful for functions in which we either need to keep options object for future reference or need to modify it for internal use.

  • It never returns input options object back (always a copy is created)
  • options can be undefined in such case empty plain object is returned.
  • Copies all enumerable properties found down prototype chain.

primitiveSet([…names]) (es5-ext/object/primitive-set)

Creates null prototype based plain object, and sets on it all property names provided in arguments to true.

safeTraverse(obj[, …names]) (es5-ext/object/safe-traverse)

Safe navigation of object properties. See http://wiki.ecmascript.org/doku.php?id=strawman:existential_operator

serialize(value) (es5-ext/object/serialize)

Serialize value into string. Differs from JSON.stringify that it serializes also dates, functions and regular expresssions.

setPrototypeOf(object, proto) (es5-ext/object/set-prototype-of)

Introduced with ECMAScript 6. If native version is not provided, it depends on existence of __proto__ functionality, if it's missing, null instead of function is exposed.

some(obj, cb[, thisArg[, compareFn]]) (es5-ext/object/some)

Analogous to Array.prototype.some Returns true if any key-value pair satisfies the provided testing function. Optionally compareFn can be provided which assures that keys are tested in given order. If provided compareFn is equal to true, then order is alphabetical (by key).

toArray(obj[, cb[, thisArg[, compareFn]]]) (es5-ext/object/to-array)

Creates an array of results of calling a provided function on every key-value pair in this object. Optionally compareFn can be provided which assures that results are added in given order. If provided compareFn is equal to true, then order is alphabetical (by key).

unserialize(str) (es5-ext/object/unserialize)

Userializes value previously serialized with serialize

validCallable(x) (es5-ext/object/valid-callable)

If given object is not callable throw TypeError in other case return it.

validObject(x) (es5-ext/object/valid-object)

Throws error if given value is not an object, otherwise it is returned.

validValue(x) (es5-ext/object/valid-value)

Throws error if given value is null or undefined, otherwise returns value.

Promise Prototype extensions

promise.finally(onFinally) (es5-ext/promise/#/finally)

Introduced with ECMAScript 2018.

RegExp Constructor extensions

escape(str) (es5-ext/reg-exp/escape)

Escapes string to be used in regular expression

isRegExp(x) (es5-ext/reg-exp/is-reg-exp)

Whether object is regular expression

validRegExp(x) (es5-ext/reg-exp/valid-reg-exp)

If object is regular expression it is returned, otherwise TypeError is thrown.

RegExp Prototype extensions

re.isSticky(x) (es5-ext/reg-exp/#/is-sticky)

Whether regular expression has sticky flag.

It's to be used as counterpart to regExp.sticky if it's not implemented.

re.isUnicode(x) (es5-ext/reg-exp/#/is-unicode)

Whether regular expression has unicode flag.

It's to be used as counterpart to regExp.unicode if it's not implemented.

re.match(string) (es5-ext/reg-exp/#/match)

Introduced with ECMAScript 6.

re.replace(string, replaceValue) (es5-ext/reg-exp/#/replace)

Introduced with ECMAScript 6.

re.search(string) (es5-ext/reg-exp/#/search)

Introduced with ECMAScript 6.

re.split(string) (es5-ext/reg-exp/#/search)

Introduced with ECMAScript 6.

re.sticky (es5-ext/reg-exp/#/sticky/implement)

Introduced with ECMAScript 6. It's a getter, so only implement and is-implemented modules are provided.

re.unicode (es5-ext/reg-exp/#/unicode/implement)

Introduced with ECMAScript 6. It's a getter, so only implement and is-implemented modules are provided.

String Constructor extensions

formatMethod(fMap) (es5-ext/string/format-method)

Creates format method. It's used e.g. to create Date.prototype.format method

fromCodePoint([…codePoints]) (es5-ext/string/from-code-point)

Introduced with ECMAScript 6

isString(x) (es5-ext/string/is-string)

Whether object is string

randomUniq() (es5-ext/string/random-uniq)

Returns randomly generated id, with guarantee of local uniqueness (no same id will be returned twice)

raw(callSite[, …substitutions]) (es5-ext/string/raw)

Introduced with ECMAScript 6

String Prototype extensions

str.at(pos) (es5-ext/string/#/at)

Proposed for ECMAScript 6/7 standard, but not (yet) in a draft

Returns a string at given position in Unicode-safe manner. Based on implementation by Mathias Bynens.

str.camelToHyphen() (es5-ext/string/#/camel-to-hyphen)

Convert camelCase string to hyphen separated, e.g. one-two-three -> oneTwoThree. Useful when converting names from js property convention into filename convention.

str.capitalize() (es5-ext/string/#/capitalize)

Capitalize first character of a string

str.caseInsensitiveCompare(str) (es5-ext/string/#/case-insensitive-compare)

Case insensitive compare

str.codePointAt(pos) (es5-ext/string/#/code-point-at)

Introduced with ECMAScript 6

Based on implementation by Mathias Bynens.

str.contains(searchString[, position]) (es5-ext/string/#/contains)

Introduced with ECMAScript 6

Whether string contains given string.

str.endsWith(searchString[, endPosition]) (es5-ext/string/#/ends-with)

Introduced with ECMAScript 6. Whether strings ends with given string

str.hyphenToCamel() (es5-ext/string/#/hyphen-to-camel)

Convert hyphen separated string to camelCase, e.g. one-two-three -> oneTwoThree. Useful when converting names from filename convention to js property name convention.

str.indent(str[, count]) (es5-ext/string/#/indent)

Indents each line with provided str (if count given then str is repeated count times).

str.last() (es5-ext/string/#/last)

Return last character

str.normalize([form]) (es5-ext/string/#/normalize)

Introduced with ECMAScript 6. Returns the Unicode Normalization Form of a given string. Based on Matsuza's version. Code used for integrated shim can be found at github.com/walling/unorm

str.pad(fill[, length]) (es5-ext/string/#/pad)

Pad string with fill. If length si given than fill is reapated length times. If length is negative then pad is applied from right.

str.repeat(n) (es5-ext/string/#/repeat)

Introduced with ECMAScript 6. Repeat given string n times

str.plainReplace(search, replace) (es5-ext/string/#/plain-replace)

Simple replace version. Doesn't support regular expressions. Replaces just first occurrence of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional $ characters escape in such case).

str.plainReplaceAll(search, replace) (es5-ext/string/#/plain-replace-all)

Simple replace version. Doesn't support regular expressions. Replaces all occurrences of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional $ characters escape in such case).

str.startsWith(searchString[, position]) (es5-ext/string/#/starts-with)

Introduced with ECMAScript 6. Whether strings starts with given string

str[@@iterator] (es5-ext/string/#/@@iterator)

Introduced with ECMAScript 6. Returns iterator object which traverses all string characters (with respect to unicode symbols)

Tests

$ npm test

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

es5-ext for enterprise

Available as part of the Tidelift Subscription

The maintainers of es5-ext and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

es5-ext's People

Contributors

akakain avatar danbell avatar deivid-rodriguez avatar dkamyshov avatar edouardklein avatar koshkin-ccna avatar martindrq avatar mathiasbynens avatar medikoo avatar sosnowsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

es5-ext's Issues

Expected identifier, string or number error

We have a test suite that uses event-emitter which is dependent on this library. That test suite ran fine in 0.10.4 but broke with 0.10.5

I believe the problem is that the function keyword still requires quotes. This pull request is a possible fix. #35

Rename all valid(ate)-* modules into ensure-*

valid-* may suggest that module returns a valid version of object in question, while it's strictly about validate functions that throw when passed object is not of expected type.

An in-range update of eslint-config-medikoo-es5 is breaking the build 🚨

Version 1.4.3 of eslint-config-medikoo-es5 just got published.

Branch Build failing 🚨
Dependency eslint-config-medikoo-es5
Current Version 1.4.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-medikoo-es5 is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ci/circleci Your tests failed on CircleCI Details

Commits

The new version differs by 2 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Update Object.deepCopy

Currently it deeply copies only plain objects and arrays, and ensures proper handling for eventual recursion.

Additionally:

  • It should copy other known object types (Date, RegExp, Function, Error(?), Set, Map etc.)
  • Custom resolver as in case of JSON.stringify should be supported
  • Recursion check should be ensured with O(1) algorithm (backed with Map)

An in-range update of eslint-config-medikoo-es5 is breaking the build 🚨

Version 1.4.2 of eslint-config-medikoo-es5 just got published.

Branch Build failing 🚨
Dependency eslint-config-medikoo-es5
Current Version 1.4.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-medikoo-es5 is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • ci/circleci CircleCI is running your tests Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

Commits

The new version differs by 3 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Push new version?

The mispelling of license in the package.json file makes automated license checking flag this module as not being permitted. Can you push a new version?

Consider remove of `global`

It's controversial as breaks CSP policy, and there are other (without reaching for global) clever ways to share something globally so ideally there should be no reason for this module.

Rename the folder something else than #

Hey,

The fact that the folder had '#' in its name caused issues with mercurial as by default it considers it to be a temporary file. I was wondering if you would mind renaming it something else as while this is totally valid, it's going to subtly break many places.

Thanks!

Add transform function

Hi Mariusz,

What do you think about adding transform function to your library? The behaviour would be similar to map, but instead of creating new object or array it would be modifying existing one. Usage example could be:

Instead of:

forEach(objects, function (value, name) {
  objects[name] = someTransformingOperation(value);
});

You could simplify it to:

transform(objects, function (value) {
  return someTransformingOperation(value);
});

Of course it should work also for arrays. Please let me know what do you think about it. The similar idea was used in one Java library: http://commons.apache.org/collections/apidocs/org/apache/commons/collections/CollectionUtils.html#transform%28java.util.Collection,%20org.apache.commons.collections.Transformer%29

PS. I wanted to check how requesting issues work in GitHub :)

Consider introduction of Object.isValue

It would be as:

module.exports = function (value) {
  return ((value !== undefined) && (value !== null));
};

It would find use cases in environments, where we would prefer to have value != null checks more self explanatory (and in which we strictly would not want to rely on sloppy == operator)

Can't install

The readme says to use npm install es5-ext, but this installs a different version than the one in the readme, so it's rather misleading, since the newer version doesn't even seem to be in the npm registry, and the older one is outdated.

Cyclic dependencies with es6-symbol, es6-iterator and d

I discovered on one of my projects that running npm outdated with a --depth of 20 or higher hung and eventually exhausted memory for the process. The cause appears to be a bunch of cyclic dependencies between the es5-ext, es5-symbol, es6-iterator and d projects.

Cyclic dependencies are generally a Bad Thing™, so I thought you might like to know. As best I can figure, here is how the projects are codependent:

es-cycles

Question

I am using react-native , and I want to be sure my code works anywhere

1- How can I be sure that my code is running safe anywhere? Must I add all ES6 shims??
2- How can I easily add ES6 shims , is there any single line require?

An in-range update of eslint is breaking the build 🚨

Version 4.11.0 of eslint was just published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.10.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ci/circleci Your tests failed on CircleCI Details

Release Notes v4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585) (薛定谔的猫)
  • d602f9e Upgrade: espree v3.5.2 (#9611) (Kai Cataldo)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364) (Teddy Katz)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605) (Teddy Katz)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603) (Moinul Hossain)
  • 980ecd3 Chore: Update copyright and license info (#9599) (薛定谔的猫)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595) (薛定谔的猫)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589) (Clément Fiorio)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590) (Teddy Katz)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588) (Teddy Katz)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560) (Toru Nagashima)
  • e5a37ce Fix: object-curly-newline for flow code (#9458) (Tiddo Langerak)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500) (薛定谔的猫)
  • b7c5b19 Fix: Correct [object Object] output of error.data. (#9561) (Jonathan Pool)
  • 51c8cf0 Docs: Disambiguate definition of Update tag (#9584) (Jonathan Pool)
  • afc3c75 Docs: clarify what eslint-config-eslint is (#9582) (Teddy Katz)
  • aedae9d Docs: fix spelling in valid-typeof example (#9574) (Maksim Degtyarev)
  • 4c5aaf3 Docs: Fix typo in no-underscore-dangle rule (#9567) (Fabien Lucas)
  • 3623600 Chore: upgrade [email protected] (#9557) (薛定谔的猫)
  • 1b606cd Chore: Remove an indirect dependency on jsonify (#9444) (Rouven Weßling)
  • 4d7d7ab Update: Resolve npm installed formatters (#5900) (#9464) (Tom Erik Støwer)
  • accc490 Fix: Files with no failures get "passing" testcase (#9547) (Samuel Levy)
  • ab0f66d Docs: Add examples to better show rule coverage. (#9548) (Jonathan Pool)
  • 88d2303 Chore: Add object-property-newline tests to increase coverage. (#9553) (Jonathan Pool)
  • 7f37b1c Build: test Node 9 on Travis (#9556) (Teddy Katz)
  • acccfbd Docs: Minor rephrase in no-invalid-this. (#9542) (Francisc)
  • 8f9c0fe Docs: improve id-match usage advice (#9544) (Teddy Katz)
  • a9606a3 Fix: invalid tests with super (fixes #9539) (#9545) (Teddy Katz)
  • 8e1a095 Chore: enable a modified version of multiline-comment-style on codebase (#9452) (Teddy Katz)
  • cb60285 Chore: remove commented test for HTML formatter (#9532) (Teddy Katz)
  • 06b491e Docs: fix duplicate entries in changelog (#9530) (Teddy Katz)
  • 2224733 Chore: use eslint-plugin-rulesdir instead of --rulesdir for self-linting (#9164) (Teddy Katz)
  • 9cf4ebe Docs: add .md to link(for github users) (#9529) (薛定谔的猫)
Commits

The new version differs by 35 commits.

  • 1a9a6a5 4.11.0
  • ef4d268 Build: changelog update for 4.11.0
  • d4557a6 Docs: disallow use of the comma operator using no-restricted-syntax (#9585)
  • d602f9e Upgrade: espree v3.5.2 (#9611)
  • 4def876 Chore: avoid handling rules instances in config-validator (#9364)
  • fe5ac7e Chore: fix incorrect comment in safe-emitter.js (#9605)
  • 6672fae Docs: Fixed a typo on lines-between-class-members doc (#9603)
  • 980ecd3 Chore: Update copyright and license info (#9599)
  • cc2c7c9 Build: use Node 8 in appveyor (#9595)
  • 2542f04 Docs: Add missing options for lines-around-comment (#9589)
  • b6a7490 Build: ensure fuzzer tests get run with npm test (#9590)
  • 1073bc5 Build: remove shelljs-nodecli (refs #9533) (#9588)
  • 7e3bf6a Fix: edge-cases of semi-style (#9560)
  • e5a37ce Fix: object-curly-newline for flow code (#9458)
  • 9064b9c Chore: add equalTokens in ast-utils. (#9500)

There are 35 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Improve validation

Be less forgiving than native ECMAScript e.g. for object functions require objects not just values, for array methods require array-likes not just values etc.

compareFn in map and map-keys?

Hello,

Is there any possibility to add compareFn to map and map-keys functions? It would be very useful if you want to merge several objects into one and you want to preserve ordering. Of course it can be achieved with forEach, but in some situations extend together with map-keys could be more convenient. Unfortunately, without compareFn in map-keys the ordering will be lost.

Kind regards,
Tomasz Przybyla

Consider move of some functions nested in `Object` namespace to global scope

It should apply to those that relate to values in general (not necessary objects), e.g. string, number functions definitely.

e.g. ensureString, ensureNaturalNumber etc.

That way we would map native API, in sense that e.g. global isNaN accepts any non numeric value, while Number.isNaN confirms strictly on type of number NaN

Introduce isPlainFunction

Contrary to isCallable it should return true on:

  • Function instances (in other words: should have accessible apply, call, bind methods. check for existence can be made on one of them)
  • Are not ES2015 classes

Consider rename of normalizeOptions into toPlainObject

  1. normalizeOptions when created, it was assumed that probably it doesn't address any other case as normalizing input options. However now there are few cases when it's used not specifically for that.
  2. It's technically about copying and unifing many objects also across their prototype chain, into one plain object.

One controversy is that we have to* functions which in case of input matching the output, return it directly (and not its copy), while here (at least in case of options normalization) we're always after copy.
Maybe we should have both toPlainObject and normalizeOptions where latter will just ensure we have the copy. Or maybe we should make all to* functions return a copy.

Additional note: both toPlainObject and normalizeOptions should copy only enumerable properties. On one side it's controversial as on not transformed options object non-emurable properties remain visible and can be read normally as an options, while after transformation it's not the case. So it makes technically both options objects not equivalent.
Still non-enumerable properties, if any (unlikely case) in most cases will be meta properties (e.g. containers for listeners of event emitter, or container of weak map polyfill), copying those opens door to some very hard to track bugs.


Extra notes:

  1. Let's make it one argument taking, as in use cases we have it's only one object we need to copy deep the prototype chain. So multi args handling can be solved as:
Object.assign({}, defaultOptions, toPlainObject(inputOptions));
  1. Support propertyKeys (or only) option, where list of names (including symbols) can be passed and in such case only those properties are copied. Additionally they should be copied even if they're not enumerable

Resolve cross dependency

es5-ext is requiring a dependency on es6-iterator and es6-iterator is requiring a dependency on es5-ext. This cross dependency is not cool according to npm that dies in a Maximum call stack size exceeded message when it's trying to shrinkwrap es5-ext (and probably even other cases).

It would be awesome if es5-ext or es6-iterator could be changed to have only a one-way dependency.

Consider removal of Boolean.isBoolean, Number.isNumber and String.isString

Their existence was justified by fact, that they also recognize object instances of those types. However:

  • Most likely it doesn't meet any use case
  • It is in opposition to how similar native functions works (they recognize only primitive values) e.g. Number.isInteger(new Number(3)) will return false.

If we agree that those functions should recognize just primitives, they can removed, as that can be achieved with plain typeof call.

tanh returns NaN for values absolutely higher than 709.8

I ran the following code:
`Math.tanh = require('es5-ext/math/tanh');

for(var i=0.;i>-800;i-=0.1){
var o = Math.tanh(i);
if(isNaN(o)){
console.log(i+' tanh returns NaN');
}
}

console.log('No NaNs')
`

Expected output was 'No NaNs'. Actual output was:
-709.8000000000928 tanh returns NaN...

Exclude test folder from npm package

I’ve installed es5-ext and noticed that it includes the test folder wich is about 1.7 MB. I think the files in the test folder are not needed in the npm package, so excluding this folder would save us some disk space and traffic.

An in-range update of eslint is breaking the build 🚨

Version 4.9.0 of eslint was just published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.8.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ci/circleci Your tests failed on CircleCI Details

Release Notes v4.9.0
  • 85388fb Fix: Correct error and test messages to fit config search path (#9428) (Jonathan Pool)
  • 62a323c Fix: Add class options for lines-around-comment (fixes #8564) (#8565) (Ed Lee)
  • 8eb4aae New: multiline-comment-style rule (fixes #8320) (#9389) (薛定谔的猫)
  • db41408 Chore: avoid applying eslint-env comments twice (#9278) (Teddy Katz)
  • febb897 Chore: avoid loose equality assertions (#9415) (Teddy Katz)
  • 2247efa Update: Add FunctionExpression to require-jsdoc (fixes #5867) (#9395) (Kai Cataldo)
  • 6791d18 Docs: Corrected noun to verb. (#9438) (Jonathan Pool)
  • b02fbb6 Update: custom messages for no-restricted-* (refs #8400) (Maja Wichrowska)
  • 02732bd Docs: Reorganized to avoid misunderstandings. (#9434) (Jonathan Pool)
  • d9466b8 Docs: Correct time forecast for tests. (#9432) (Jonathan Pool)
  • f7ed84f Docs: Add instruction re home-directory config files (refs #7729) (#9426) (Jonathan Pool)
  • 30d018b Chore: Add Aladdin-ADD & VictorHom to README (#9424) (Kai Cataldo)
  • 2d8a303 Docs: fix examples for prefer-numeric-literals (#9155) (Lutz Lengemann)
  • d7610f5 Docs: Add jquery warning to prefer-destructuring (#9409) (Thomas Grainger)
  • e835dd1 Docs: clarify no-mixed-operators (fixes #8051) (Ruxandra Fediuc)
  • 51360c8 Docs: update block-spacing details (fixes #8743) (#9375) (Victor Hom)
  • 6767857 Update: fix ignored nodes in indent rule when using tabs (fixes #9392) (#9393) (Robin Houston)
  • 37dde77 Chore: Refactor SourceCode#getJSDocComment (#9403) (Kai Cataldo)
  • 9fedd51 Chore: Add missing space in blog post template (#9407) (Kevin Partington)
  • 7654c99 Docs: add installing prerequisites in readme. (#9401) (薛定谔的猫)
  • 786cc73 Update: Add "consistent" option to array-bracket-newline (fixes #9136) (#9206) (Ethan Rutherford)
  • e171f6b Docs: add installing prerequisites. (#9394) (薛定谔的猫)
  • 74dfc87 Docs: update doc for class-methods-use-this (fixes #8910) (#9374) (Victor Hom)
  • b4a9dbf Docs: show console call with no-restricted-syntax (fixes #7806) (#9376) (Victor Hom)
  • 8da525f Fix: recognise multiline comments as multiline arrays (fixes #9211) (#9369) (Phil Quinn)
  • c581b77 Chore: Error => TypeError (#9390) (薛定谔的猫)
  • ee99876 New: lines-between-class-members rule (fixes #5949) (#9141) (薛定谔的猫)
  • 9d3f5ad Chore: report unused eslint-disable directives in ESLint codebase (#9371) (Teddy Katz)
  • 1167638 Update: add allowElseIf option to no-else-return (fixes #9228) (#9229) (Thomas Grainger)
  • 4567ab1 New: Add the fix-dry-run flag (fixes #9076) (#9073) (Rafał Ruciński)
Commits

The new version differs by 32 commits.

  • 235c7dd 4.9.0
  • b6f31a9 Build: changelog update for 4.9.0
  • 85388fb Fix: Correct error and test messages to fit config search path (#9428)
  • 62a323c Fix: Add class options for lines-around-comment (fixes #8564) (#8565)
  • 8eb4aae New: multiline-comment-style rule (fixes #8320) (#9389)
  • db41408 Chore: avoid applying eslint-env comments twice (#9278)
  • febb897 Chore: avoid loose equality assertions (#9415)
  • 2247efa Update: Add FunctionExpression to require-jsdoc (fixes #5867) (#9395)
  • 6791d18 Docs: Corrected noun to verb. (#9438)
  • b02fbb6 Update: custom messages for no-restricted-* (refs #8400)
  • 02732bd Docs: Reorganized to avoid misunderstandings. (#9434)
  • d9466b8 Docs: Correct time forecast for tests. (#9432)
  • f7ed84f Docs: Add instruction re home-directory config files (refs #7729) (#9426)
  • 30d018b Chore: Add Aladdin-ADD & VictorHom to README (#9424)
  • 2d8a303 Docs: fix examples for prefer-numeric-literals (#9155)

There are 32 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Cannot find module '../../object/valid-value' on npm install

Hey guys, just bringing this issue from imagemin/imagemin#104 (comment) since we found out it's coming from es5-ext, more precisely, the root cause is this line.

Thanks


I am not sure what is really happening but it usually to install fine from my CI environment, however now npm install is returning the following chain of errors. Any ideas?

> [email protected] postinstall /home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js

module.js:333
    throw err;
          ^
Error: Cannot find module '../../object/valid-value'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/vinyl-fs/node_modules/glob-stream/node_modules/unique-stream/node_modules/es6-set/node_modules/es5-ext/array/#/clear.js:7:13)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/vinyl-fs/node_modules/glob-stream/node_modules/unique-stream/node_modules/es6-set/polyfill.js:3:22)

> [email protected] postinstall /home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/jpegtran-bin
> node lib/install.js

module.js:333
    throw err;
          ^
Error: Cannot find module '../../object/valid-value'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/vinyl-fs/node_modules/glob-stream/node_modules/unique-stream/node_modules/es6-set/node_modules/es5-ext/array/#/clear.js:7:13)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
npm WARN optional dep failed, continuing [email protected]

> [email protected] postinstall /home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin
> node lib/install.js

module.js:333
    throw err;
          ^
Error: Cannot find module '../../object/valid-value'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/vinyl-fs/node_modules/glob-stream/node_modules/unique-stream/node_modules/es6-set/node_modules/es5-ext/array/#/clear.js:7:13)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/ubuntu/indigofx.co.uk/node_modules/pakku/node_modules/imagemin/node_modules/vinyl-fs/node_modules/glob-stream/node_modules/unique-stream/node_modules/es6-set/polyfill.js:3:22)
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]

An in-range update of eslint is breaking the build 🚨

Version 4.6.0 of eslint just got published.

Branch Build failing 🚨
Dependency eslint
Current Version 4.5.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details
  • ci/circleci Your tests failed on CircleCI Details

Release Notes v4.6.0
  • 56dd769 Docs: fix link format in prefer-arrow-callback.md (#9198) (Vse Mozhet Byt)
  • 6becf91 Update: add eslint version to error output. (fixes #9037) (#9071) (薛定谔的猫)
  • 0e09973 New: function-paren-newline rule (fixes #6074) (#8102) (Teddy Katz)
  • 88a64cc Chore: Make parseJsonConfig() a pure function in Linter (#9186) (Teddy Katz)
  • 1bbac51 Fix: avoid breaking eslint-plugin-eslint-comments (fixes #9193) (#9196) (Teddy Katz)
  • 3e8b70a Fix: off-by-one error in eslint-disable comment checking (#9195) (Teddy Katz)
  • 73815f6 Docs: rewrite prefer-arrow-callback documentation (fixes #8950) (#9077) (Charles E. Morgan)
  • 0d3a854 Chore: avoid mutating report descriptors in report-translator (#9189) (Teddy Katz)
  • 2db356b Update: no-unused-vars Improve message to include the allowed patterns (#9176) (Eli White)
  • 8fbaf0a Update: Add configurability to generator-star-spacing (#8985) (Ethan Rutherford)
  • 8ed779c Chore: remove currentScopes property from Linter instances (refs #9161) (#9187) (Teddy Katz)
  • af4ad60 Fix: Handle error when running init without npm (#9169) (Gabriel Aumala)
  • 4b94c6c Chore: make parse() a pure function in Linter (refs #9161) (#9183) (Teddy Katz)
  • 1be5634 Chore: don't make Linter a subclass of EventEmitter (refs #9161) (#9177) (Teddy Katz)
  • e95af9b Chore: don't include internal test helpers in npm package (#9160) (Teddy Katz)
  • 6fb32e1 Chore: avoid using private Linter APIs in astUtils tests (refs #9161) (#9173) (Teddy Katz)
  • de6dccd Docs: add documentation for Linter methods (refs #6525) (#9151) (Teddy Katz)
  • 2d90030 Chore: remove unused assignment. (#9182) (薛定谔的猫)
  • d672aef Chore: refactor reporting logic (refs #9161) (#9168) (Teddy Katz)
  • 5ab0434 Fix: indent crash on sparse arrays with "off" option (fixes #9157) (#9166) (Teddy Katz)
  • c147b97 Chore: Make SourceCodeFixer accept text instead of a SourceCode instance (#9178) (Teddy Katz)
  • f127423 Chore: avoid using private Linter APIs in Linter tests (refs #9161) (#9175) (Teddy Katz)
  • 2334335 Chore: avoid using private Linter APIs in SourceCode tests (refs #9161) (#9174) (Teddy Katz)
  • 2dc243a Chore: avoid using internal Linter APIs in RuleTester (refs #9161) (#9172) (Teddy Katz)
  • d6e436f Fix: no-extra-parens reported some parenthesized IIFEs (fixes #9140) (#9158) (Teddy Katz)
  • e6b115c Build: Add an edit link to the rule docs’ metadata (#9049) (Jed Fox)
  • fcb7bb4 Chore: avoid unnecessarily complex forEach calls in no-extra-parens (#9159) (Teddy Katz)
  • ffa021e Docs: quotes rule - when does \n require backticks (#9135) (avimar)
  • 60c5148 Chore: improve coverage in lib/*.js (#9130) (Teddy Katz)
Commits

The new version differs by 31 commits.

  • 8f01a99 4.6.0
  • c0acbf2 Build: changelog update for 4.6.0
  • 56dd769 Docs: fix link format in prefer-arrow-callback.md (#9198)
  • 6becf91 Update: add eslint version to error output. (fixes #9037) (#9071)
  • 0e09973 New: function-paren-newline rule (fixes #6074) (#8102)
  • 88a64cc Chore: Make parseJsonConfig() a pure function in Linter (#9186)
  • 1bbac51 Fix: avoid breaking eslint-plugin-eslint-comments (fixes #9193) (#9196)
  • 3e8b70a Fix: off-by-one error in eslint-disable comment checking (#9195)
  • 73815f6 Docs: rewrite prefer-arrow-callback documentation (fixes #8950) (#9077)
  • 0d3a854 Chore: avoid mutating report descriptors in report-translator (#9189)
  • 2db356b Update: no-unused-vars Improve message to include the allowed patterns (#9176)
  • 8fbaf0a Update: Add configurability to generator-star-spacing (#8985)
  • 8ed779c Chore: remove currentScopes property from Linter instances (refs #9161) (#9187)
  • af4ad60 Fix: Handle error when running init without npm (#9169)
  • 4b94c6c Chore: make parse() a pure function in Linter (refs #9161) (#9183)

There are 31 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.