1

I see the following Lightning Lint tool error in my project

 error  ecma-intrinsics  Invalid Intrinsic API                
  Line:31:30
              selectedRecords: Object.values( component.get('v.selectedRecordsMap') ),
                                ^

I have read this documentation article

Validate JavaScript Intrinsic APIs (ecma-intrinsics) This rule deals with the intrinsic APIs in JavaScript, more formally known as ECMAScript. When LockerService is enabled, the framework prevents the use of unsupported API objects or calls. That means your Lightning components code is allowed to use: Features built into JavaScript (“intrinsic” features) Published, supported features built into the Lightning Component framework Published, supported features built into LockerService SecureObject objects What exactly are these “intrinsic APIs”? They’re the APIs defined in the ECMAScript Language Specification. That is, things built into JavaScript. This includes Annex B of the specification, which deals with legacy browser features that aren’t part of the “core” of JavaScript, but are nevertheless still supported for JavaScript running inside a web browser.

Note that some features of JavaScript that you might consider intrinsic—for example, the window and document global variables—are superceded by SecureObject objects, which offer a more constrained API.

Rule Details This rule verifies that use of the intrinsic JavaScript APIs is according to the published specification. The use of non-standard, deprecated, and removed language features is disallowed.

I have looked through the related documents but still I don't understand what is wrong with getting values list from map using Object.values() method?

Is there any way to avoid this lint error?

2
  • Hey, did you find any solution to avoid this error? even I'm getting a similar error.
    – Venky
    Oct 17, 2017 at 8:14
  • No, I just give up, maybe, I would return to this later
    – Patlatus
    Oct 18, 2017 at 8:25

2 Answers 2

0

Is there any way to avoid this lint error?

There is. You could not use Object.values as it is, essentially, a syntactic sugar for an Object.keys with a .map. You are able to replace it with:

var obj = {name: "Robert"};

// returns an 'Array [ "Robert" ]' object.
Object.values();

// same but without .values
Object.keys(obj).map(function(k) { return obj[k] });

Just be careful to check if the object you are using is not falsy. If it is, say, undefined, you'll get a TypeError:

Uncaught TypeError: can't convert undefined to object

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .