Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 974 Bytes

README.md

File metadata and controls

50 lines (38 loc) · 974 Bytes

set

Transform this.set('someProp', value) to set(this, 'someProp', value) and ensure import of

import { set } from "@ember/object";

Usage

npx lil-codemods run set path/of/files/ or/some**/*glob.js

# or

yarn global add lil-codemods
lil-codemods run set path/of/files/ or/some**/*glob.js

Input / Output


basic

Input (basic.input.js):

import { get } from "@ember/object";
function hello() {
  this.set("whyNot", "1");
  const okay = 1;
  this.set("okay", okay);
}

Output (basic.output.js):

import { get, set } from "@ember/object";
function hello() {
  set(this, "whyNot", "1");
  const okay = 1;
  set(this, "okay", okay);
}