Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 395 Bytes

no-delete.md

File metadata and controls

20 lines (14 loc) · 395 Bytes

Forbid the use of delete

delete is an operator to remove fields from an object or elements from an array. This purposely mutates data, which is not wanted when doing functional programming.

Fail

delete foo;
delete foo.bar;
delete foo[bar];

Pass

var _ = require('lodash/fp');

var fooWithoutBar = _.omit('bar', foo);
var fooWithoutField = _.omit(bar, foo);