medikoo / es5-ext Goto Github PK
View Code? Open in Web Editor NEWECMAScript extensions (with respect to upcoming ECMAScript features)
License: ISC License
ECMAScript extensions (with respect to upcoming ECMAScript features)
License: ISC License
As described here https://ponyfoo.com/articles/proposal-draft-for-flatten-and-flatmap
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]
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!
Object.keys
returns only key strings, therefore no symbols are assigned with current implementation
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.
As that's what becomes a standard -> https://github.com/tc39/proposal-string-pad-start-end
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.
Their existence was justified by fact, that they also recognize object instances of those types. However:
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.
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
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.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:
Object.assign({}, defaultOptions, toPlainObject(inputOptions));
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 enumerableWe 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
I'm pretty sure tests are not needed in production. :)
They just bloat project dependencies, install time, use bandwidth, etc.
For more info see https://github.com/inikulin/dmn
It'll allow consumers to provide more meaningful messages e.g.:
ensureObject(x, "%o should be a valid descriptor object");
It's what exactly diff does, and it's not obvious from diff name
It should assure that length is not only a number but also a valid number
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
?
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.
It would be especially useful in light of having most extensions provided as methods
According to medikoo/es6-iterator#2 it may slow down hot paths.
There's either issue in unconditional max
call or internals of toInteger
.
As a side note toPosInt will be renamed to toNatural
Hello !
The test
directory weights 1.7Mo. Is it possible to ignore it with .npmingore to save disk space ?
I can make a PR for this.
Thanks.
It'll be what we may prefer in some cases, and it should not break existing cases (but may, so major bump is required)
As apparently it's what TC39 agreed on -> tc39/proposal-Array.prototype.includes@4b6b953
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.
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 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
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.
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.
lines-around-comment
(fixes #8564) (#8565) (Ed Lee)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
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Math.trunc
should be used instead
As decided by TC39 https://twitter.com/bterlson/status/535921786525736960
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 :)
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...
Function.prototype
should be used instead
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)
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.
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 💪
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
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
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 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
date
is more on pair with API than day
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.
lines-around-comment
(#9589) (Clément Fiorio)npm test
(#9590) (Teddy Katz)no-invalid-this
. (#9542) (Francisc)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
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Currently it deeply copies only plain objects and arrays, and ensures proper handling for eventual recursion.
Additionally:
JSON.stringify
should be supportedO(1)
algorithm (backed with Map
)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:
It's more concise, and and
already lives as an extension for sets.
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
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?
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)You know why :P
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.