Skip to content
This repository has been archived by the owner on Feb 4, 2018. It is now read-only.

clone method #102

Open
blond opened this issue Apr 14, 2017 · 1 comment
Open

clone method #102

blond opened this issue Apr 14, 2017 · 1 comment

Comments

@blond
Copy link
Member

blond commented Apr 14, 2017

const BemEntityName = require('@bem/entity-name');

const buttonName = new BemEntityName({ block: 'button' });

buttonName.clone(); // BemEntityName({ block: 'button' })

const mutant = buttonName.clone({ elem: 'text' }); // BemEntityName({ block: 'button', elem: 'text' })

mutant.clone({ elem: null }); // BemEntityName({ block: 'button' })
@blond
Copy link
Member Author

blond commented Apr 15, 2017

Simple clone without parameters looks strange for immutable objects. Especially if we to implement optimization for create same instances (#103).

const BemEntityName = require('@bem/entity-name');

const name = new BemEntityName({ block: 'button' });
const clone = buttonName.clone();

name === clone // WTF ???

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant