File tree Expand file tree Collapse file tree 7 files changed +37
-21
lines changed Expand file tree Collapse file tree 7 files changed +37
-21
lines changed Original file line number Diff line number Diff line change 1+ lib
2+ node_modules
Original file line number Diff line number Diff line change 11machine :
22 node :
3- version : 5.6 .0
3+ version : 6.1 .0
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22 "name" : " immutable-proxy" ,
33 "version" : " 0.0.1" ,
44 "description" : " access immutable values more easily" ,
5- "main" : " index.js" ,
5+ "main" : " lib/ index.js" ,
66 "peerDependencies" : {
77 "immutable" : " ^3.7.6"
88 },
1919 },
2020 "scripts" : {
2121 "test" : " mocha tests --compilers js:babel-register --recursive --harmony_shipping " ,
22- "build" : " babel src/index.js --out-file index.js && npm run build-umd && npm run build-min" ,
22+ "build" : " babel src -d lib && npm run build-umd && npm run build-min" ,
2323 "build-umd" : " NODE_ENV=production webpack src/index.js umd/index.js" ,
2424 "build-min" : " NODE_ENV=production webpack -p src/index.js umd/index.min.js"
2525 },
Original file line number Diff line number Diff line change 11import Immutable from 'immutable'
2+ import List from './list'
23import Map from './map'
34
45module . exports = {
56 ...Immutable ,
7+ List,
68 Map
7- }
9+ }
Original file line number Diff line number Diff line change 1+ import { List } from 'immutable'
2+
3+ export default initialData => {
4+ const immutableList = List ( initialData )
5+
6+ return new Proxy ( immutableList , {
7+ get : ( proxy , name ) => {
8+ const immutableName = name === 'length'
9+ ? 'size'
10+ : name
11+
12+ return immutableList . get ( immutableName ) || immutableList [ immutableName ]
13+ }
14+ } )
15+ }
Original file line number Diff line number Diff line change 1+ import List from '../src/list'
2+ import { expect } from 'chai'
3+
4+ describe ( 'List Proxy' , ( ) => {
5+ it ( 'should access value without calling .get' , ( ) => {
6+ const data = List ( [ 1 , 2 , 3 ] )
7+ expect ( data [ 1 ] ) . to . equal ( 2 )
8+ } )
9+
10+ it ( 'should provide the "length" property' , ( ) => {
11+ const data = List ( [ 1 , 2 , 3 ] )
12+ expect ( data . length ) . to . equal ( 3 )
13+ } )
14+ } )
You can’t perform that action at this time.
0 commit comments